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!

Select Distinct Records

Status
Not open for further replies.

WillRiley

MIS
Aug 7, 2001
17
GB
Please can anyone help me with this one... hopefully an easy
one for some of you...

My table contains a number of records for the field
"groupid" (i.e. a new recod with the same groupid is
created whenever one of the other fields gets updated)

I am querying a table and want to select only the latest
details (most up to date) for each "groupid"

Can anyone help me with the 'select' statement
for this.....

thanx. will
 
You can't write or change the SELECT statement inside Crystal Reports. Crystal has to generate the SELECT for a report, although you can write it in your database (in a view or SP) or in the CR SQL Designer and report off of that.

In CR you have to Group by the GroupID and enter a group selection formula that says:

{Date} = Maximum ({date}, {GroupID})

It will bring all dates back to CR but only display the last one. Use running totals to get good grand totals
Ken Hamady, On-site Custom Crystal Reports Training & Consulting
Public classes and individual training.
Guide to using Crystal in VB
tek@kenhamady.com
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top