I have this query that I want to convert to slick:
SELECT (date_part('epoch', SUM(end_time - start_time))*1000)::bigint FROM v2_game
I could live with an act happening in scala and not in a database, but I don’t understand how to do the subtraction. end_time and start_time are both dates represented as timestamps in the database. So far I have this:
val datePart = SimpleFunction.binary[String, Date, Double]("date_part")
val q = for {
g <- Games
} yield datePart("epoch", g.startTime)
So how to subtract / add values? Google doesn't return any results in my searches, either it's really simple, or nobody wants to use a little math in the queries.
I am using Slick 1.0.1 with postgres sql
source
share