[thelist] T-SQL join I can't grok
Canfield, Joel
JCanfield at PacAdvantage.org
Mon Nov 21 18:10:00 CST 2005
> Canfield, Joel scribeva in 2005-11-21 23:42:
> > 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'm just about to call it a day, but this might give you a
> good starting
> point:
> http://www.google.com/search?q=mssql+case+statement
I should have included that I'm guessing I'll want to use 'CASE', just
don't know how.
This returns a 'subquery returns multiple results' error:
'User or Group' = case a.object_type
when 'g' then (select g.FULLNAME 'Group' from groups g)
when 'u' then (select u.FULLNAME 'User' from docusers u)
end
More information about the thelist
mailing list