I need to have a result from a SELECT query with all the rows containing “word1” in column 1 and all the rows containing “word2” in column 2.
If a row contains both, I want it to appear twice. What query should I do?
I’m not sure I understand your question, but check your docs for conditional statements and you might try something along the lines of the following:
SELECT CASE when PATINDEX('WORD1',COLUMN1)>0 then WORD1CASE when PATINDX('WORD2',COLUMN2)>0 then WORD2
In the big picture of things, you are trying to construct a cross tab. The limitations of the technique are that you have to know how many groups you need to end up with, so while the populations of word are small this will work.