Quantcast
Channel: Transact-SQL forum
Viewing all articles
Browse latest Browse all 23857

union vs case in select list

$
0
0

Hi,

   which one will be faster( i have tested it , i wanted to know in general)

1)

select *

from abc drr
LEFT JOIN (SELECT bridgeid  
             FROM bridge1 SS
             WHERE SS.Status=1
             UNION
             SELECT bridgeid    FROM bridge2) L
             ON  l.bridgeid    = drr.bridgeid   

2)

2)
select *,
 case drr.frombridg1 when 1 then
(select bridgeid from bridge1 where Status=1 and bridgeid  = drr.bridgeid    )
else (select bridgeid from bridge2 where Status=1 and bridgeid  = drr.bridgeid and status=1)
end
from abc drr

yours sincerly


Viewing all articles
Browse latest Browse all 23857

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>