Forum OpenACS Development: Re: SQL queries 'n TCL

Collapse
9: Re: SQL queries 'n TCL (response to 8)
Posted by Iuri Sampaio on
It's done!
PAtrick and Malte,
It's really great the subselect you two mentioned on this thread.


SELECT o.organization_id,
o.name,
o.legal_name,
o.reg_number,
o.notes,
ot.type as organization_type
FROM organizations o,
organization_types ot,
organization_type_map tm
WHERE
o.organization_id = tm.organization_id and
o.organization_id in (SELECT ow.organization_id
FROM organization_owner ow
WHERE ow.user_id = :user_id) and
tm.organization_type_id = ot.organization_type_id and
o.package_id in (SELECT ow.package_id
FROM organization_owner ow
WHERE ow.organization_id = o.organization_id)

Thanks for the link to the docs. I didn't find before on PG website