When I programming with the ScalaQuery, how to build a "select count(*) from table" statement?
I used a
Query(TestTable.count)
but the generated select statement is:
select count(*) from (select column1 from TestTable t2) t1
I want the:
select count(*) from TestTable
sorry for my poor english.
import org.scalaquery.ql.extended.MySQLDriver.Implicit._
import org.scalaquery.session._
import org.scalaquery.session.Database.threadLocalSession
import org.scalaquery.ql.Query
import org.scalaquery.ql.basic.{BasicTable => Table}
object Test {
val db = Database.forURL(...)
db withSession {
val q = Query(TestTable.count)
println(q.selectStatement)
}
}
object TestTable extends Table[(Long, Int)]("test") {
def id = column[Long]("id")
def config = column[Int]("config")
def * = id ~ config
}