S
Shoelaces
I have a table that stores events:
eventname
url
planner
eventdate
etc.
I have a query of this table that sorts first by planner and then by date.
SELECT eventname, eventurl, planner, eventdate
FROM events
ORDER BY planner, eventdate;
I have a need now to create a query that would return only the first record
for each planner.
Each planner can have multiple events. I am interested, presently, in only
the first (by date) event for each planner.
I thought "min" might prove helpful, but I get an error that eventname isn't
part of the aggregate.
SELECT eventname, eventurl, planner, min(eventdate) AS FirstDate
FROM events
ORDER BY planner, eventdate;
How do I construct the query to disregard the other events for each planner?
Or perhaps better, how do I construct the query to pull only the first event
for each planner? I am not great with SQL, so any handholding you can offer
will be appreciated.
Thanks!
eventname
url
planner
eventdate
etc.
I have a query of this table that sorts first by planner and then by date.
SELECT eventname, eventurl, planner, eventdate
FROM events
ORDER BY planner, eventdate;
I have a need now to create a query that would return only the first record
for each planner.
Each planner can have multiple events. I am interested, presently, in only
the first (by date) event for each planner.
I thought "min" might prove helpful, but I get an error that eventname isn't
part of the aggregate.
SELECT eventname, eventurl, planner, min(eventdate) AS FirstDate
FROM events
ORDER BY planner, eventdate;
How do I construct the query to disregard the other events for each planner?
Or perhaps better, how do I construct the query to pull only the first event
for each planner? I am not great with SQL, so any handholding you can offer
will be appreciated.
Thanks!