Hi, I am trying to find a solution for the below problem, but could not think of any way. The problem is, i need to find if a givenword exist in a table.
if 1-- then Asian country if 2- north american country if 3-- rest of the world
given list of words 'India,Srilanka,China'.
The question is: get country names with value "1" and is in the given list of words. If the countryshows up with value 1 but not in the list of words, then code need to be changed to 3.
Expected output : india 1 indian islands 1 srilanka 1 islands of srilanka 1 china 1
if select * from @country then expected result is india 1, indian islands 1, srilanka 1, islands of srilanka 1, china 1, us 2, canada 2, uk 3, france 3. plzz help me out how to accomplish this.
thanks in adv
Here is your data repeated here:
Can I get an A? :)
Updated the SELECT-statement after Oleg pointed out I hadn't read the question good enough.
Have a look at Jeff Modens article about Tally tables: **http://www.sqlservercentral.com/articles/T-SQL/62867/**
Here's an example based on Jeffs article, which I think will solve your problem: