how to get the QUARTERLY data [message #248166] |
Thu, 28 June 2007 03:55 |
msg2ajay
Messages: 51 Registered: June 2007 Location: KUALA LUMPUR
|
Member |
|
|
hi,
i hav the following query, from which is it possible to get the quarterly results.....
ie.
Q1:Jan-Mar
Q2:Apr-Jun
Q3:Jul-Sept
Q4:Oct-Dec
select a.name,
a.actno,
a.countrycd,
a.curcd,
a.amtfin,
a.settamt
from ifmr a,
ifschd b,
globtab c
where actcls IN ('2','3') and
(to_char(to_date(b.txday,'YYYYMMDD'),'YYYY') = to_char(to_date(c.globtab_tbsdy,'YYYYMMDD'),'YYYY'))
order by a.prodcd;
EX:
Q1:
name actno countrycd curcd amtfin settamt
ILIC 00062000001911 KW KWD 1000000.00 100000.00
Q2:
name actno countrycd curcd amtfin settamt
ILIC 00062000001911 KW KWD 1000000.00 100000.00
Q3:
name actno countrycd curcd amtfin settamt
ILIC 00062000001911 KW KWD 1000000.00 100000.00
Q4:
name actno countrycd curcd amtfin settamt
ILIC 00062000001911 KW KWD 1000000.00 100000.00
thx,
Ajay.
[Updated on: Thu, 28 June 2007 03:56] Report message to a moderator
|
|
|
|
|
Re: how to get the QUARTERLY data [message #248213 is a reply to message #248205] |
Thu, 28 June 2007 05:21 |
|
Maaher
Messages: 7065 Registered: December 2001
|
Senior Member |
|
|
Ajay,
Michel has showed how you can transform a date into the corresponding quarter. If you use that transformation in a WHERE clause, you can limit the results of your query to the first quarter. Think for a minute, test for yourself.
MHE
|
|
|