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

Canfield, Joel JCanfield at PacAdvantage.org
Wed Nov 23 16:10:10 CST 2005


    I wrote

> > 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.

  so matt wrote

> select (case p.object_type when 'g' then g.fullname when 'u' then
> u.fullname else NULL END) as fullname
> from lotsa l, joined u, tables g
> where joelcanwritethejoins=1;

Bingo. Thanks, matt (et al)

joel



More information about the thelist mailing list