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 Changeman get multiple "Browse C... elixir1986 Compuware & Other Tools 4 Fri Jul 14, 2017 1:48 am
No new posts How to write Specific Fields from Mul... Padhu SYNCSORT 6 Thu Jul 06, 2017 10:26 am
No new posts SQL - select data available in index Nileshkul DB2 3 Mon Jun 26, 2017 1:30 am
No new posts Unable to create multiple files using... mbattu COBOL Programming 3 Fri May 05, 2017 5:35 pm
No new posts Group Data based on a key Arun Raj DFSORT/ICETOOL 7 Thu Apr 27, 2017 11:29 pm


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