korma / Korma

Tasty SQL for Clojure.
http://sqlkorma.com
1.47k stars 222 forks source link

Aggregate STDEV operation is Error When using Mysql #245

Open lzwjava opened 10 years ago

lzwjava commented 10 years ago

error: FUNCTION query.STDEV does not exist

It generates sql string such as:

   "STDEV(`query`.`consume_time`) AS `stdev`"

Actually , in mysql, stdev function is stddev, not stdev . Correct:

   "STDDEV(`query`.`consume_time`) AS `stdev`"

but when:

(select 
  query
  (aggregate (stddev :consume_time) :stddev_time))

It says unable to resolve stddev.

So there's not solution but use exec-raw.

immoh commented 10 years ago

Unfortunately some DBs use STDEV and some STDDEV. I'm happy to take in a PR that add supports for STDDEV.