Skip to content
mkleen edited this page Oct 12, 2010 · 2 revisions

Counts

Counting all values of a column:

 for(t  <- MyTable) yield t.myColumn.count  

Counting only distinct values of a column:

 for(t  <- MyTable) yield t.myColumn.countDistinct

Counting all rows of a query result:

(for(...) yield ...).count 

The latter creates unnecessarily complicated queries instead of a plain
COUNT in ScalaQuery 0.9.0. This is fixed in master and will be part
of release 0.9.1.

Clone this wiki locally