Redundancy After SELECT

Redundancy After SELECT

Question:
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?

Answer:
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.

Share the Post:
data observability

Data Observability Explained

Data is the lifeblood of any successful business, as it is the driving force behind critical decision-making, insight generation, and strategic development. However, due to its intricate nature, ensuring the

Heading photo, Metadata.

What is Metadata?

What is metadata? Well, It’s an odd concept to wrap your head around. Metadata is essentially the secondary layer of data that tracks details about the “regular” data. The regular

XDR solutions

The Benefits of Using XDR Solutions

Cybercriminals constantly adapt their strategies, developing newer, more powerful, and intelligent ways to attack your network. Since security professionals must innovate as well, more conventional endpoint detection solutions have evolved