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 MikeeOK on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Conditional most recent record

Status
Not open for further replies.

gillf

Technical User
Aug 14, 2002
35
GB
v 9 off a SQL database. My report is on sales and costs, grouped by contract number.
The main report is on sales, and has two tables: Ccs_Quotes which holds the contract details and Ccs_Sil_Invoice_Line, which holds the invoice details.

A parameter limits sales records to <= date and a select statement on the document type pulls out only records that have no sales doc or 2 types of sales document from a possible 6.
That works fine, but it is finding the first record it comes to and I need it to find the most recent. How do I tell it to find the most recent date of my selected types of document, given that there may be unwanted doc types with later dates?

 
If you group the documents you want, you can get the maximum date using a summary total. Or sort by date order with the group, ascending or decending, so that the header or footer will show the latest date.

[yinyang] Madawc Williams (East Anglia, UK) [yinyang]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top