Need Help In Query (merged 3) [message #382077] |
Tue, 20 January 2009 22:07  |
sr_orcl
Messages: 82 Registered: January 2009 Location: mumbai
|
Member |

|
|
My requirement is I have to check the
select case
when f.dsum < f.psum then
'P'
ELSE
'F'
end case
from (select A.id, sum(a.DISb_SUM) dsum, sum(b.pymt_sum) psum
from --,B.id,
(select drawdownscheduledtlid id,
sum(disb_amt) DISb_SUM,
dense_rank() over(partition by drawdownscheduledtlid order by null) top
from lot_drawdownbreakup_dtl
where compapplid = 36
group by drawdownscheduledtlid) A, ---brkup dtl
(select id,
sum(paymentamt) pymt_sum,
dense_rank() over(partition by id order by null) t1
from lot_drawdownschedule_dtl
where compapplid = 36
group by id) B --schedule dtl
where A.id = b.id
group by A.id) f
this is my query,
Right now it is generating right o/p.But if my f.dsum < f.psum returns multi row then how to check that multi row records.Means If my results contain 'F' then it should return 'F' not 'P'
(If it has 'F' then it should returns 'F'.
It has 'P' or 'F' value .I have to check that it sholu return only 1 'P' or 'F' if it has more than 1 record for 'P' or 'F')
Thanks And Regards,
Sonali
[Mod-Edit: Frank added [code]-tags to improve readability]
[Updated on: Wed, 21 January 2009 00:05] by Moderator Report message to a moderator
|
|
|
|
|
|
|
|
|
Re: Need Help In Query (merged 3) [message #382090 is a reply to message #382077] |
Tue, 20 January 2009 23:11  |
 |
Michel Cadot
Messages: 68737 Registered: March 2007 Location: Saint-Maur, France, https...
|
Senior Member Account Moderator |
|
|
Please read OraFAQ Forum Guide, especially "How to format your post?" section.
Make sure that lines of code do not exceed 80 characters when you format.
Indent the code (See SQL Formatter), use code tags and align the columns in result.
Use the "Preview Message" button to verify.
Also always post your Oracle version (4 decimals).
Post a Test case: create table and insert statements along with the result you want with these data.
Regards
Michel
|
|
|