sql switch/case 'where' clause


i attempted poison around, nonetheless i couldn't anything assistance me out.



i'm perplexing sql:



declare @locationtype varchar(50);
declare @locationid int;

select column1, column2
from viewwhatever
where
case @locationtype
'location' following account_location = @locationid
'area' following xxx_location_area = @locationid
'division' following xxx_location_division = @locationid


i know i shouldn't have put '= @locationid' during finish any one, nonetheless i can't syntax even tie being correct. sql keeps angry '=' initial line...



how i this?



Comments

Popular posts from this blog

list macos calm editors formula editors

how i practical urls indicate .aspx pages asp.net deployed an iis? (preferably but iis)

jaxb - xjc - reworking generated typesafe enum category members