Max Date?

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have an Event table, with Event Name and Date
How do i get the Date and Event name of the most recent event to appear in a query
I tried to use the Max function in the Total row for Date but what i got was the Max date of every event.
How do i get the max date with its corresponding event name?

Any help will be appreciated! Thanx!
 
Make your query a plain select one (not Totals), and in the criterion line
under the date field type in the following statement:

In (SELECT Max(Date) FROM [Event table])

Make sure you use the actual table and field name.

HTH,
Nikos

need help said:
I have an Event table, with Event Name and Date.
How do i get the Date and Event name of the most recent event to appear in a query?
I tried to use the Max function in the Total row for Date but what i got
was the Max date of every event.
 
To receive the last date and the corresponding event you
need, Nikos, as a matter of fact two queries. As a
curiosity you can get the same information also in only
one pass. You must only concatenate date and event in one
common information:

SELECT Max(Format([Date],"yyyy-mm-dd") & [Event name]) AS
result FROM [Event table]

If it is necessarily you can separate the "result" at the
end.

NON



-----Original Message-----
Make your query a plain select one (not Totals), and in the criterion line
under the date field type in the following statement:

In (SELECT Max(Date) FROM [Event table])

Make sure you use the actual table and field name.

HTH,
Nikos

I have an Event table, with Event Name and Date.
How do i get the Date and Event name of the most recent
event to appear in
a query?
I tried to use the Max function in the Total row for
Date but what i got
was the Max date of every event.
How do i get the max date with its corresponding event name??

Any help will be appreciated! Thanx!!


.
 
Assuming that there is ONLY one EVENT on the max date

SELECT EVENT, EventDate
FROM Table
WHERE EventDate =
(SELECT Max(EventDate)
FROM Table)

That will give you every Event that occurred on the Max EventDate.
To receive the last date and the corresponding event you
need, Nikos, as a matter of fact two queries. As a
curiosity you can get the same information also in only
one pass. You must only concatenate date and event in one
common information:

SELECT Max(Format([Date],"yyyy-mm-dd") & [Event name]) AS
result FROM [Event table]

If it is necessarily you can separate the "result" at the
end.

NON

-----Original Message-----
Make your query a plain select one (not Totals), and in the criterion line
under the date field type in the following statement:

In (SELECT Max(Date) FROM [Event table])

Make sure you use the actual table and field name.

HTH,
Nikos

I have an Event table, with Event Name and Date.
How do i get the Date and Event name of the most recent
event to appear in
a query?
I tried to use the Max function in the Total row for
Date but what i got
was the Max date of every event.
How do i get the max date with its corresponding event name??

Any help will be appreciated! Thanx!!


.
 
Another approach:

SELECT TOP 1 Date, [Event Name]
FROM [Event table] ORDER by [Date] DESC

NON
-----Original Message-----
Assuming that there is ONLY one EVENT on the max date

SELECT EVENT, EventDate
FROM Table
WHERE EventDate =
(SELECT Max(EventDate)
FROM Table)

That will give you every Event that occurred on the Max EventDate.
To receive the last date and the corresponding event you
need, Nikos, as a matter of fact two queries. As a
curiosity you can get the same information also in only
one pass. You must only concatenate date and event in one
common information:

SELECT Max(Format([Date],"yyyy-mm-dd") & [Event name]) AS
result FROM [Event table]

If it is necessarily you can separate the "result" at the
end.

NON

-----Original Message-----
Make your query a plain select one (not Totals), and in the criterion line
under the date field type in the following statement:

In (SELECT Max(Date) FROM [Event table])

Make sure you use the actual table and field name.

HTH,
Nikos

news:7EABC4FE-77B7-4BB5-879B- (e-mail address removed)...
I have an Event table, with Event Name and Date.
How do i get the Date and Event name of the most
recent
event to appear in
a query?
I tried to use the Max function in the Total row for Date but what i got
was the Max date of every event.
How do i get the max date with its corresponding
event
name??
Any help will be appreciated! Thanx!!



.
.
 
Back
Top