troubleshooting Question

How to get distinct list when all records are true

Avatar of Bharat Guru
Bharat Guru asked on
Microsoft SQL Server
6 Comments1 Solution111 ViewsLast Modified:
I have a table as below
Select Id, Feld1, Feld2, Feld3 from table1

How can I get distinct list of Ids when either ( All Feld1 = 'Y'  or All Feld2 = 'Y'   or All Feld2 = 'Y'  )

Id, Feld1, Feld2, Feld3
1    Y, N, N
1    N, N, N
2    Y, N, Y
2    Y, N, N
3    N, Y, N
3    N, Y, N
3    N, Y, N

Should return  2, 3

Id, Feld1, Feld2, Feld3
1    Y, N, N
2    Y, N, Y
2    Y, N, N
3    N, Y, N
3    N, Y, N
3    N, Y, N
Should return 1, 2, 3
ASKER CERTIFIED SOLUTION
Join our community to see this answer!
Unlock 1 Answer and 6 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 6 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros