[postmodern-devel] Multiple inner joins ...

Ralf Mattes rm at seid-online.de
Wed Oct 17 15:36:28 UTC 2007


On Wed, 2007-10-17 at 17:09 +0200, Marijn Haverbeke wrote:
> Hello Ralf,
> 
Hey, thanks!
That was a fast reply ;-)
Yes, that seems to work fine. 
Thanks a lot 

  RalfD


> Try...
> 
> (s-sql:sql (:select 'foo 'bar 'baz :from (:as (:select 'foo :from 'x
> :where 'x) 'tmp1)
>     :inner-join (:as (:select 'bar :from 'x :where 'x) 'tmp2) :on (:=
> 'tmp1.id 'tmp2.id)
>     :inner-join (:as (:select 'baz :from 'x :where 'x) 'tmp3) :on (:=
> 'tmp2.id 'tmp3.id)))
> 
> ... which gives ...
> 
> "(SELECT foo, bar, baz FROM (SELECT foo FROM x WHERE x) AS tmp1 INNER
> JOIN (SELECT bar FROM x WHERE x) AS tmp2 ON (tmp1.id = tmp2.id) INNER
> JOIN (SELECT baz FROM x WHERE x) AS tmp3 ON (tmp2.id = tmp3.id))"
> 
> Cheers,
> Marijn




More information about the postmodern-devel mailing list