SQL Help
- From: bcap <rayh@xxxxxxxxxxxx>
- Date: Tue, 16 Jun 2009 12:27:49 -0700 (PDT)
Hi,
I have a table named Booking and another called Events
A booking can have multiple events tied into it.
Here is what my query results look like:
EventID BookingID BookingName EventDesc
StartDate EndDate
200 101 SQL Event Breakfast 6/16/09 9:00:00
AM 6/16/09 10:00:00 AM
200 101 SQL Event Breakfast 6/16/09 9:00:00
AM 6/16/09 10:00:00 AM 200 101 SQL Event
Breakfast 6/16/09 9:00:00 AM 6/16/09 10:00:00 AM
Here is my SQL query
SELECT dbo.Event.EventID, dbo.Booking.BookingID,
dbo.Booking.BookingName, dbo.Event.EventDesc, dbo.Event.StartDate,
dbo.Event.EndDate
FROM dbo.Event INNER JOIN dbo.Booking ON dbo.Event.BookingID =
dbo.Booking.BookingID
WHERE (dbo. Booking.BookingID = 101)
Even though there are three events tied to this booking, I would like
to show just one record of the event showing.
For example, I would like to produce:
EventID BookingID BookingName
StartDate EndDate
200 101 SQL Event 6/16/09 9:00:00 AM
6/16/09 6:00:00 PM
Thus, the Event shows up one time in my query and only shows the
earliest start date and latest end date instead of all events.
Is this possible?
Thanks so much for any time and thoughts in advance!
.
- Follow-Ups:
- Re: SQL Help
- From: Plamen Ratchev
- Re: SQL Help
- Prev by Date: Re: Change Column Position
- Next by Date: Re: Change Column Position
- Previous by thread: Change Column Position
- Next by thread: Re: SQL Help
- Index(es):
Relevant Pages
|