View previous topic :: View next topic
|
Author |
Message |
Ashishpanpaliya
New User
Joined: 13 Oct 2017 Posts: 34 Location: India
|
|
|
|
Hi,
Plz need help in writing sql query.
I have below sample table . Here col A is defined as primary col.
Col A Col B Col C
-------------------------------------
T1 123 A
T2 123 B
T3 123 C
T4 111 B
T5 111 D
Here I want to fetch Col B where Col C has all value 'A', 'B' and 'C'
I would have use sub select but col C has more 3 value.
Could you please let me know if better solution.
Note - I need this for some data analysis and not for program. |
|
Back to top |
|
|
Rohit Umarjikar
Global Moderator
Joined: 21 Sep 2010 Posts: 3076 Location: NYC,USA
|
|
|
|
Code: |
Select col B
From table
Where col C IN ( ‘A’, ‘B’, ‘C’)
Group by col B
Having count(*) = 3 |
|
|
Back to top |
|
|
|