X-Git-Url: http://git.kpe.io/?a=blobdiff_plain;f=sql%2Fexpressions.lisp;h=5967f24e941c707d14a175fb7de02db7365506df;hb=814ef0649edf23f0136d5cad2d7738ae72e79871;hp=d7a95ef74f83a11cd85ab96e69ed87af14cfe9ad;hpb=539444af449f3769b75f71b32f10204c40d011f4;p=clsql.git diff --git a/sql/expressions.lisp b/sql/expressions.lisp index d7a95ef..5967f24 100644 --- a/sql/expressions.lisp +++ b/sql/expressions.lisp @@ -625,9 +625,13 @@ uninclusive, and the args from that keyword to the end." (write-string " ON " *sql-stream*) (output-sql on database)) (when where - (write-string " WHERE " *sql-stream*) - (let ((*in-subselect* t)) - (output-sql where database))) + (let ((where-out (string-trim '(#\newline #\space #\tab #\return) + (with-output-to-string (*sql-stream*) + (let ((*in-subselect* t)) + (output-sql where database)))))) + (when (> (length where-out) 0) + (write-string " WHERE " *sql-stream*) + (write-string where-out *sql-stream*)))) (when group-by (write-string " GROUP BY " *sql-stream*) (if (listp group-by)