Help with SQL coding to select minimum date

  • Thread starter Thread starter Michel Walsh
  • Start date Start date
M

Michel Walsh

Depends if you want other fields or not. Assuming you don't need other
fields, you can try something like:


SELECT cohort, MIN(relsdate)
FROM tableName
WHERE relsdate BETWEEN date1 AND date2
GROUP BY cohort


where the only field not involved in the GROUP BY is the relsdate field, the
field you want the minimum.


Vanderghast, Access MVP
 
I hope I can say this half way intelligently. I have a record set with 2
date fields (One in date and One out date) I have a query to select the
records between a specific date range (no problem) now problem: I need to
also select the earliest date in at the same time. So thus far I have this
code as an expression in empty field: Cohort: IIf([relsdate] Between
[7/1/fy] And [6/30/fy],"1"," ") this codes all who are released between my
date selection with a 1. Often there are more than one record for a person
with different time intervals. Simply, I need to code the earliest record
for each cohort that is within the relsdate range and code it with the 1.
I am pretty new at this coding stuff; got a lot to learn.
Thanks
Pat

"If you can find a path with no obstacles, it probably doesn't lead
anywhere"
 
Back
Top