Thursday, January 30, 2014

How to implement this in SQL?

marser,


another method :)



select ta.id1,tb.id,tc.val from
(select distinct id1 from @tab1) ta
cross join
(select id from @tab2) tb
left join @tab1 tc on ta.id1=tc.id1 and tb.id=tc.id2





Thanks,

Jay

<If the post was helpful mark as 'Helpful' and if the post answered your query, mark as 'Answered'>


No comments:

Post a Comment