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

More date problems!

Status
Not open for further replies.

Fibee

Programmer
Jul 26, 2002
39
GB
Hi
I have a query that contains planning applications and also the dates that the applications were last edited/updated. Some of the applications may be edited just once or twice and some maybe edited hundreds of times.What I am trying to do is just extract the first occurrence that the application was edited (ie the earliest date). I have tried using the min function and it complains about aggregate functions.
My query looks something like this:

SELECT DISTINCT [QUERY - APP FORMATTED].[Application No], Min([DATEAPRECV]) AS Expr1,
FROM [QUERY - APP FORMATTED]
ORDER BY [QUERY - APP FORMATTED].[Application No];

What am I doing wrong??
Fi
 
Hi, This may help. Add an order by for your date. The first record return for that application No. will be the earlest date.
John
************************************

SELECT [QUERY - App FORMATTED].[Application No]
FROM [QUERY - APP FORMATTED]
ORDER BY [QUERY - APP FORMATTED].[Application No],
[QUERY - APP FROMATTED].DATEAPRECV
**************************************
 
I can sort by date field as well and it does put the earliest date first but how do I get rid of the other dates? I only want to display the first occurence for each application.
 
Hmmmmm .... how about using a group and then use the TOP statement .... John
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top