[thelist] T-SQL join I can't grok
Mark Rees
mrees at itsagoodprice.com
Tue Nov 22 05:16:29 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,
Try something like this
CASE p.object_type
WHEN 'g' THEN g.fullname
ELSE u.fullname
END
AS FULLNAME
> depending on whether p.object_type is 'g' or 'u')
> from (lotsa joined tables; I can write the joins)
More information about the thelist
mailing list