Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase «««123

T-SQL Challenge #1 Expand / Collapse
Author
Message
Posted Thursday, January 19, 2012 3:30 AM
Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum Newbie

Group: General Forum Members
Last Login: Thursday, January 19, 2012 5:10 PM
Points: 2, Visits: 6
select
a.code
, aname
, bname
, cname
from (
select
code
, bName
, ROW_NUMBER() over (partition by code order by code) as br
from @b
) b
right join (
select
code
, cname
, ROW_NUMBER() over (partition by code order by code) as cr
from @c
) c on b.code = c.code and b.br = c.cr
right join @a a on c.code = a.code
Post #1238517
« Prev Topic | Next Topic »

Add to briefcase «««123

Permissions Expand / Collapse