0

How do we get distinct rowcount in activejdbc? I tried many different variations but none of them worked

Tablename.count("?", "distinct id")
Tablename.count("distinct ?", "id") //missing expression
Base.exec("select count(distinct id) from tablename") //return 1 always (probably the count)
Bala
  • 11,068
  • 19
  • 67
  • 120
  • what you are trying to do is not any different from plain SQL. What will you get if you just execute: select count(distinct id) from tablename in the database shell? – ipolevoy Mar 26 '15 at 02:17

1 Answers1

0

You are using the wrong API. Since you are selecting, you need to use any one of the Base.find... methods, not Base.exec, which is for INSERT/UPDATE/DELETE.

ipolevoy
  • 5,432
  • 2
  • 31
  • 46