From 7d4cc64ecbd74a3aceee994263bf0bb135382b80 Mon Sep 17 00:00:00 2001 From: Justin Kramer Date: Tue, 6 Aug 2013 16:29:09 -0400 Subject: [PATCH] :distinct-on helper fn; fixes #1 --- src/honeysql/format.clj | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/honeysql/format.clj b/src/honeysql/format.clj index 4e7e6ad..f721b15 100644 --- a/src/honeysql/format.clj +++ b/src/honeysql/format.clj @@ -76,6 +76,9 @@ (defmethod fn-handler "count-distinct" [_ & args] (str "COUNT(DISTINCT " (comma-join (map to-sql args)) ")")) +(defmethod fn-handler "distinct-on" [_ & args] + (str "DISTINCT ON (" (comma-join (map to-sql args)) ")")) + (defmethod fn-handler "=" [_ a b & more] (if (seq more) (apply expand-binary-ops "=" a b more)