[postmodern-devel] Multiple inner joins ...

Marijn Haverbeke marijnh at gmail.com
Wed Oct 17 15:09:05 UTC 2007


Hello Ralf,

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