IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

Help in writting SQL query


IBM Mainframe Forums -> FAQ & Basics
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
Ashishpanpaliya

New User


Joined: 13 Oct 2017
Posts: 34
Location: India

PostPosted: Wed Jan 27, 2021 9:54 am
Reply with quote

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
View user's profile Send private message
Rohit Umarjikar

Global Moderator


Joined: 21 Sep 2010
Posts: 3076
Location: NYC,USA

PostPosted: Wed Jan 27, 2021 12:52 pm
Reply with quote

Code:
Select col B
From table
Where col C IN ( ‘A’, ‘B’, ‘C’)
Group by col B
Having count(*) = 3
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> FAQ & Basics

 


Similar Topics
Topic Forum Replies
No new posts Need help with ADABAS query (COBOL-AD... All Other Mainframe Topics 0
No new posts RC query -Time column CA Products 3
No new posts Dynamically pass table name to a sele... DB2 2
No new posts Query on edit primary command CLIST & REXX 5
No new posts Query on edit primary command CLIST & REXX 1
Search our Forums:

Back to Top