Re: select subquery

Harald Hanche-Olsen <[email protected]> Thu, 16 Dec 2010 23:42:32 +0100 (CET)
Newsgroups gmane.lisp.clsql.general
Message-ID <[email protected]>
[Fulvio Ciriaco <[email protected]> (2010-12-16 21:59:45 UTC)]

> thanks for the suggestion, but it was tried.
> The problem is with the parenthesis:
> select a from tablea where id in (select c from tableb)
>                                  -                    -
> 
> (clsql:select [a] :from [tablea] :where
>      [in [id] [select [c] :from [tableb]]])
> translates to
> select a from tablea where id in select c from tableb
> which is incorrect sql.

Is your clsql up to date? I think an older version had that problem.
Now I get this:

CLSQL> (sql [select [a] :from [tablea] :where
	      [in [id] [select [c] :from [tableb]]] ])
"SELECT A FROM TABLEA WHERE (ID IN (SELECT C FROM TABLEB))"

- Harald