Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

Select specific based on multiple columns

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DB2
View previous topic :: :: View next topic  
Author Message
ParagChouguley

Active User


Joined: 03 Feb 2007
Posts: 175
Location: PUNE(INDIA)

PostPosted: Fri Jan 11, 2008 6:45 pm    Post subject: Select specific based on multiple columns
Reply with quote

Hi ALL,
I have a DB2 table having few columns (Say Col1, Col2, Col3, Col4,......).
None of them is Primary key and all have duplicates allowed.
Table have several thousand rows.
Now I want to select only those rows having following combination values for first 3 columns.
Code:

Col1            Col2         Col3
A                B             C
A                Z             M
Q                F             L
.                 .             .
.                 .             .
.                 .             .

This data have say 50 rows.

Duplicates are allowed in my result set.
This has to be done thru SQL query which I will run thru SPUFI. ( and not thru COBOL program)
--Parag
Back to top
View user's profile Send private message

Craq Giegerich

Senior Member


Joined: 19 May 2007
Posts: 1512
Location: Virginia, USA

PostPosted: Fri Jan 11, 2008 7:01 pm    Post subject: Re: Select specific based on multiple columns
Reply with quote

ParagChouguley wrote:
Hi ALL,
I have a DB2 table having few columns (Say Col1, Col2, Col3, Col4,......).
None of them is Primary key and all have duplicates allowed.
Table have several thousand rows.
Now I want to select only those rows having following combination values for first 3 columns.
Code:

Col1            Col2         Col3
A                B             C
A                Z             M
Q                F             L
.                 .             .
.                 .             .
.                 .             .

This data have say 50 rows.

Duplicates are allowed in my result set.
This has to be done thru SQL query which I will run thru SPUFI. ( and not thru COBOL program)
--Parag


How about showing us what you have tried and the results!
Back to top
View user's profile Send private message
ParagChouguley

Active User


Joined: 03 Feb 2007
Posts: 175
Location: PUNE(INDIA)

PostPosted: Fri Jan 11, 2008 8:18 pm    Post subject: Reply to: Select specific based on multiple columns
Reply with quote

I couldn't do this !

--Parag
Back to top
View user's profile Send private message
Craq Giegerich

Senior Member


Joined: 19 May 2007
Posts: 1512
Location: Virginia, USA

PostPosted: Fri Jan 11, 2008 8:52 pm    Post subject: Re: Reply to: Select specific based on multiple columns
Reply with quote

ParagChouguley wrote:
I couldn't do this !

--Parag

Code:

SELECT * FROM TABLE
WHERE (COL1 = 'A' AND COL2 = 'B' AND COL3 = 'C')
   OR (COL1 = 'A' AND COL2 = 'Z' AND COL3 = 'M')
   OR (COL1 = 'Q' AND COL2 = 'F' AND COL3 = 'L');


That is difficult.
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DB2 All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Unable to catalog a gdg dataset resid... Shovan JCL & VSAM 7 Fri Mar 24, 2017 2:24 pm
No new posts JCL to Set Return code based on DB2 S... vinu78 DB2 17 Mon Mar 13, 2017 9:47 pm
No new posts To display values of multiple rows in... vinu78 DB2 2 Thu Mar 09, 2017 1:20 pm
No new posts Route a product's job to specific lpar vasanthz All Other Mainframe Topics 9 Thu Mar 02, 2017 2:22 am
No new posts Inserting records based on conditions vickey_dw DFSORT/ICETOOL 9 Wed Feb 22, 2017 1:33 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us