Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Unique Row with details

Status
Not open for further replies.

Ringers

Technical User
Feb 26, 2004
180
AU
I am trying to write SQL that will show the invoice_head details and every invoice_line(purchase orders). The catch is for everytime there is a purchase order over the first row, you don't repeat the invoice head row.

I have attached a excel spreadsheets that show the format of invoice that I need. It shows my current SQL output, the required SQL output there is also the schema for the tables and sample data.

Columns A-V from Invoice_head
Columns W-AL from Invoice_line
(some of the headings in excel are changed from table name)


Maybe another way to think of it is invoice head is the parent and invoice line is the child. Show every child record but only show the parent data(invoice head) for the first child record(invoice line).

e.g.
Head----Line
1--------1
null------2
null------3
2--------1
3--------1
4--------1
null------2

 
That should be done in your FrontEnd reporting tool.


Borislav Borissov
VFP9 SP2, SQL Server 2000,2005 & 2008.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top