From 28ca0add971c6dff89039bb2c6f315677f50cb03 Mon Sep 17 00:00:00 2001 From: Justin Kramer Date: Mon, 3 Dec 2012 12:39:06 -0500 Subject: [PATCH] count-distinct fn handler --- src/honeysql/format.clj | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/honeysql/format.clj b/src/honeysql/format.clj index 04b4eb3..250089f 100644 --- a/src/honeysql/format.clj +++ b/src/honeysql/format.clj @@ -60,6 +60,9 @@ (paren-wrap (string/join (str " " op-upper " ") args)) (str op-upper (paren-wrap (comma-join args)))))) +(defmethod fn-handler "count-distinct" [_ & args] + (str "COUNT(DISTINCT " (comma-join (map to-sql args)) ")")) + (defmethod fn-handler "=" [_ a b & more] (if (seq more) (apply expand-binary-ops "=" a b more)