Quantcast
Channel: Active questions tagged row - Stack Overflow
Viewing all articles
Browse latest Browse all 477

Filter row based in same id in T-SQL

$
0
0

I have this table and I need to filter some rows.

If the same number has line with Account = Tax and Account = Pay, I have to exclude these two rows.

For example, the number 1 has one row with tax and one row with pay in account column, so I have to exclude all rows with number 1.

In the same way, number 2 has one row with tax and another with tax too, so I have to keep them.

Can you help me?

numberACCOUNTCOLOR
1TAXBLUE
1PAYPINK
2TAXRED
2TAXGREEN

I expect to get this result:

numberACCOUNTCOLOR
2TAXRED
2TAXGREEN

Viewing all articles
Browse latest Browse all 477

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>