View previous topic :: View next topic
|
Author |
Message |
abhi.5873
New User
Joined: 28 Jan 2013 Posts: 8 Location: India
|
|
|
|
Hi ,
I am writing a Cobol db2 program.
I have 3 different queries with same column names.
After fetch the data i need to sort with 3 columns.
What are different options to do this?
Could please tell ? |
|
Back to top |
|
|
chandan.inst
Active User
Joined: 03 Nov 2005 Posts: 275 Location: Mumbai
|
|
|
|
Hi,
Your requirement is not clear..
It will be great if you elaborate on it.
In any case are you going to execute those three queries then you can use UNION fro those three queries.
Regards,
Chandan |
|
Back to top |
|
|
abhi.5873
New User
Joined: 28 Jan 2013 Posts: 8 Location: India
|
|
|
|
Hi Chandan,
I am extarcting some details from 1st query and using this values i am extracting details from 2 nd query.
while extraction i have column quantity if it is sufficent then i won't go to 3 query if it is not i will go to third query and fetch the data after get the data i need to sort by three column called trade date and settlement date and insert timestamp then i need to proceess those records with some logic.
I want to know what athe different apporach to do this. |
|
Back to top |
|
|
chandan.inst
Active User
Joined: 03 Nov 2005 Posts: 275 Location: Mumbai
|
|
|
|
Hi,
Still its not clear..
You are going to use data from only 3rd or 2nd query for final processing or you will be using data from 1st query also?
It will be great if you elaborate with sample input and sample output
It will help people here to answer/guide correctly
Regards,
Chandan |
|
Back to top |
|
|
abhi.5873
New User
Joined: 28 Jan 2013 Posts: 8 Location: India
|
|
|
|
Yes correct i will use only 2 and 3 query results
for example from 1 st quert i get the data as below
id trd-date settle-date quantity timestamp
1 23 jan 30 jan 3000 10:11:23:55555
3 25 jan 30 jan 4000 10:23:11:66666
from 2 nd query i will get
id trd-date settle-date quantity timestamp
2 24 jan 30 jan 3000 10:11:23:55555
4 26 jan 30 jan 4000 10:23:11:66666
desired output is
id trd-date settle-date quantity timestamp
1 23 jan 30 jan 3000 10:11:23:55555
2 24 jan 30 jan 3000 10:11:23:55555
3 25 jan 30 jan 4000 10:23:11:66666
4 26 jan 30 jan 4000 10:23:11:66666 |
|
Back to top |
|
|
chandan.inst
Active User
Joined: 03 Nov 2005 Posts: 275 Location: Mumbai
|
|
|
|
Hi,
As you will be using outputs from two different queries then why to write query output as it is in output file first and then sort entire output file in different step?
Else let us know what is the criteria you will like to select dta from query 2 and query 3?
Regards,
Chandan |
|
Back to top |
|
|
|