Permalink
Browse files

Add support for (:count foo :distinct)

  • Loading branch information...
1 parent c7b49bd commit 59d5568d1f4e68213e83fc24a0cbe1960dc1a2bd Andy Chambers committed with Sep 11, 2012
Showing with 5 additions and 0 deletions.
  1. +5 −0 s-sql/s-sql.lisp
View
5 s-sql/s-sql.lisp
@@ -494,6 +494,11 @@ with a given arity."
(def-sql-op :extract (unit form)
`("EXTRACT(" ,@(sql-expand unit) " FROM " ,@(sql-expand form) ")"))
+(def-sql-op :count (what &optional distinct)
+ `("COUNT(" ,@(when (eq distinct :distinct)
+ '("DISTINCT "))
+ ,@(sql-expand what) ")"))
+
(def-sql-op :between (n start end)
`("(" ,@(sql-expand n) " BETWEEN " ,@(sql-expand start) " AND " ,@(sql-expand end) ")"))

0 comments on commit 59d5568

Please sign in to comment.