Query problems

Joined
Sep 7, 2010
Messages
1
Reaction score
0
I have an existing query that I need to modify. The (MS-Access) database has two tables, an Events table which holds information about, well, events, and an EventCalendar table which holds dates, times, and a foreign key reference to an event in the Events table. The query needs to retrieve the next two upcoming featured events to display. To that end, my current query is:


Code:
  SELECT StartDate, StartTime, PresentedBy, IsFeatured, VendorEventID, FeaturedImage, FeaturedText
          FROM EventCalendar, Events
          WHERE EventCalendar.EventID = Events.EventID AND StartDate >= NOW() AND IsFeatured = -1
          ORDER BY StartDate


This works well, except for when the next two upcoming performances are for the same event, but on different days; what I want instead is to only retrieve distinct events. So for instance if the next three events in the calendar are:
10/1/10 "The Wizard of Oz"
10/2/10 "The Wizard of Oz"
10/3/10 "Rent"

I don't want to retrieve the second record; I want to retrieve the first and third.

Someone in another forum suggested exploring using MIN() and GROUP BY to achieve the results that I need but I must confess, I don't know how to approach that. I've been experimenting but with no success so far.

I hope I've been clear!

Thanks.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top