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

how do I return only the first record of a set ?

Status
Not open for further replies.

bogojugolev

Programmer
Sep 20, 2002
5
US
Hi,
I'm trying to return only the first occurence of records meeting certain criteria. I'd like to bring back only the earliest date of all records where customer_ID = x. Is Crystal able to use a "minimum" definition in the record selection area and if so, how would the selection statement appear?

Thanks for any guidance
 
This would require grouping of all fields and turning on perform grouping on the server, as to build a SQL Statement akin to real SQL.

Here's CD's paper on this:


Note that min() should work the same as their example of sum().

A simple cheat is to let Crystal determine the lowest date, though you'd have to slug through all rows in Crystal.

Group by Customer and sort by date.

Place the date in the Customer Group Header, the first date will be displayed, which is the lowest (min).

-k

kai@informeddatadecisions.com
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top