|
Posted by mike on 03/01/06 21:33
I am not sure how to approach this problem or if I can even do it
within SQL.
Say I have 2 tables invoice_hdr and invoice_dtl. I want to pull
specific fields from both tables, I want the data to be grouped
together however I want the information to be on different lines. One
for the information from the header and one for each corresponding
detail record.
So my output might look like
Invoice_number (1), Invoice_date, Customer_Number
Item_number (1-1), qty, price, description
Item_number (1-2), qty, price, description
Invoice_number (2), Invoice_data, Customer_number
Item_number (2-1), qty, price, description
Item_number (2-2), qty, price, description
Item_number (2-3), qty, price, description
etc..
So the invoice_number (1) is my first invoice and item_number (1-1)
would be the 1st item on tins invoice, etc...
My ultimate goal is to export this to a text or csv file.
Thanks.
[Back to original message]
|