Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Null values for header columns

SudheerReddyOct 7 2008 — edited Oct 7 2008
Hi,

I need help with sql query, if we selecting data from header and line table we can expect the header values are duplicate values, but i need one values in first row, rest of the rows header values should be null. for example

SQL Statement:
-----------------------
select aia.INVOICE_ID, INVOICE_AMOUNT, aida.AMOUNT
from XXDR_AP_INVOICES_ALL aia, XXDR_AP_INV_DISTRIBUTIONS_ALL aida
where vendor_id =234233
and aia.INVOICE_ID = aida.INVOICE_ID
and aia.invoice_id = 67862

Results:
---------------------------
INVOICE_ID INVOICE_AMOUNT AMOUNT

67862 110 100
67862 110 10
-------------------------------------------------------------------

in above query we are getting invoice amount and invoice_id are duplicate, here i need

Expecting result:
-----------------------------------------------------------------------
INVOICE_ID INVOICE_AMOUNT AMOUNT

67862 110 100
NULL NULL 10
-------------------------------------------------------------------

please can you help me out how we can develop the query for all rows.


thanks
reddy
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Nov 4 2008
Added on Oct 7 2008
7 comments
835 views