Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist 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 How to select record x+7 or x+2 based... JoAnn Kulcyk SYNCSORT 6 Tue Jan 16, 2018 10:49 pm
No new posts Copy Specific Groups V S Amarendra Reddy SYNCSORT 10 Thu Jan 11, 2018 1:16 am
No new posts Sum the fields in particular format f... sharana64 DFSORT/ICETOOL 9 Fri Jan 05, 2018 1:11 am
No new posts Merging 2 records at multiple rows wi... Bijesh DFSORT/ICETOOL 2 Wed Dec 06, 2017 1:50 am
No new posts Can EDCICONV convert EBCDIC to ASCII... natt.sut IBM Tools 3 Fri Nov 17, 2017 8:46 pm

Facebook
Back to Top
 
Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us