[thelist] T-SQL join I can't grok

Canfield, Joel JCanfield at PacAdvantage.org
Mon Nov 21 17:42:01 CST 2005


(specifically MSSQL in case it matters)

I have four tables to join in order to get a human-readable list. Here's
pseudo-code for what I'm looking for:

select d.document_number, p.permissions, 
[here's the tricky part]
(either u.fullname or g.fullname, 
depending on whether p.object_type is 'g' or 'u')
from (lotsa joined tables; I can write the joins)

I just can't get my head around the logic to decide which table to query
depending on the value of p.object_type for each row returned.

thanks

joel



More information about the thelist mailing list