Home » SQL & PL/SQL » SQL & PL/SQL » Need Help In Query (merged 3)
Need Help In Query (merged 3) [message #382077] Tue, 20 January 2009 22:07 Go to next message
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 Query Help [message #382079 is a reply to message #382077] Tue, 20 January 2009 22:11 Go to previous messageGo to next message
BlackSwan
Messages: 26766
Registered: January 2009
Location: SoCal
Senior Member
You need to help us by following the Posting Guidelines as stated below.
http://www.orafaq.com/forum/t/88153/0/
So we can help you & please be consistent & correct in your postings.

Post DDL for tables.
Post DML for test data.

Post expected/desired results.
Re: Need Help In Query [message #382081 is a reply to message #382077] Tue, 20 January 2009 22:14 Go to previous messageGo to next message
BlackSwan
Messages: 26766
Registered: January 2009
Location: SoCal
Senior Member
STOP re-posting same problem!
Re: Need Help In Query [message #382082 is a reply to message #382081] Tue, 20 January 2009 22:15 Go to previous messageGo to next message
sr_orcl
Messages: 82
Registered: January 2009
Location: mumbai
Member

sorry ,hee it sends me error msg..that why i sent it twice.
Re: Need Help In Query [message #382083 is a reply to message #382077] Tue, 20 January 2009 22:17 Go to previous messageGo to next message
BlackSwan
Messages: 26766
Registered: January 2009
Location: SoCal
Senior Member
>that why i sent it twice.
TWICE?
You posted same message 3 times!
Re: Need Help In Query [message #382084 is a reply to message #382083] Tue, 20 January 2009 22:23 Go to previous messageGo to next message
sr_orcl
Messages: 82
Registered: January 2009
Location: mumbai
Member

How to delete the topic posted by us.
Re: Need Query Help [message #382085 is a reply to message #382079] Tue, 20 January 2009 22:43 Go to previous messageGo to next message
sr_orcl
Messages: 82
Registered: January 2009
Location: mumbai
Member

please check my requiremnt in the attached file
Re: Need Help In Query (merged 3) [message #382090 is a reply to message #382077] Tue, 20 January 2009 23:11 Go to previous message
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
Previous Topic: capture IF statement
Next Topic: Trigger on View
Goto Forum:
  


Current Time: Mon Feb 17 19:04:37 CST 2025