#Left join on demand

2 messages · Page 1 of 1 (latest)

icy kestrel
#

Hi there!
is it possible to left join only if previous left join return null?
for example, I have couple of permissions: user, article, media.
I want to join user permission first, and if something is returned, I do NOT want to perform other two types of left join. But if user permission is null, I want to check if there is article permission. If not, I want to check if there is media permission.

Thank you in advance!

true crescent
#

Sanity check: if it's not possible in SQL, it's not possible with an ORM. You'll need 2 queries for that.