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