I have three tables which I am attempting to join together however because I want to reference one of the tables twice in the statement I am not sure if it will work.
The Users table is basically a list of names - FirstName, Surname and UserID
The Meetings table has the details of all meetings - when they are, when they start and finish, who is organising them (OrganiserID) and so on.
The Attendees table has a UserID and a MeetingID.
The MeetingID field in Attendees ties in with the MeetingID field in the MeetingsTable and the UserID field in the Attendees ties in with the UserID field in the Users table. The OrganiserID is also meant to tie in with the UserID field in the Users table as well.
The idea is to execute a query that shows the name of the person attending the meeting and also the name of the person who is organising the meeting. Is this possible or would I have to re-organise my tables?
Thanks
SELECT Attendees.UserID, Attendees.MeetingID, Users.FirstName, Users.Surname, Meetings.Title, Meetings.RoomID, Meetings.Date, Meetings.StartTime FROM ((Attendees LEFT JOIN Users ON Attendees.UserID=Users.UserID) LEFT JOIN Users ON Attendees.OrganiserID=Users.UserID) LEFT JOIN Meetings ON Attendees.MeetingID=Meetings.MeetingID
The Users table is basically a list of names - FirstName, Surname and UserID
The Meetings table has the details of all meetings - when they are, when they start and finish, who is organising them (OrganiserID) and so on.
The Attendees table has a UserID and a MeetingID.
The MeetingID field in Attendees ties in with the MeetingID field in the MeetingsTable and the UserID field in the Attendees ties in with the UserID field in the Users table. The OrganiserID is also meant to tie in with the UserID field in the Users table as well.
The idea is to execute a query that shows the name of the person attending the meeting and also the name of the person who is organising the meeting. Is this possible or would I have to re-organise my tables?
Thanks
SELECT Attendees.UserID, Attendees.MeetingID, Users.FirstName, Users.Surname, Meetings.Title, Meetings.RoomID, Meetings.Date, Meetings.StartTime FROM ((Attendees LEFT JOIN Users ON Attendees.UserID=Users.UserID) LEFT JOIN Users ON Attendees.OrganiserID=Users.UserID) LEFT JOIN Meetings ON Attendees.MeetingID=Meetings.MeetingID