SQL Server Query for values within same Table -
i have data table (not structured) in have following
clientid | parameter | value 111..........street..........evergreen 111..........zip................75244 111..........country.........usa 222..........street..........evergreen 222..........zip................75244 222..........country.........usa 333..........street..........evergreen 333..........zip................75240 333..........country.........usa 444..........street..........evergreen 444..........zip................75240 444..........country.........usa 555..........street..........evergreen 555..........zip................75240 555..........country.........usa 666..........street..........some street 666..........zip................75244 666..........country.........usa
for want select client id on street = evergreen zip 75244, have on 700k rows so, exporting big issue.
my idea was:
select clientid (select clientid table1 value = 'evergreen') zip = '75244'
but wont give me accurate results in case values clientids 111 , 222 because match criteria im looking street= evergreen adn zip=75244
is there way this?
try this:
select clientid table1 (parameter='street' , value='evergreen') , clientid in (select clientid table1 parameter='zip' , value='75244')
Comments
Post a Comment