Morning all,I'm rather new to SQL, I've bumbled my way through 2 queries which both work in they're own right, however I would like to combine them into a single query but no idea where to start, I've done a bit of googling and reading up but I'm just getting more confused...First query:SELECT Bookings.B_BID, Teachers.T_TID, (Teachers.T_Title + ' ' + Teachers.T_FName + ' ' + Teachers.T_LName) AS Name, Teachers.T_Address1, Teachers.T_Address2, Teachers.T_Address3, Teachers.T_Address4, Teachers.T_Postcode, Teachers.T_Phone_LL, Teachers.T_Phone_Mobile, Teachers.T_JobGroup FROM dbo.Bookings INNER JOIN dbo.Teachers ON Bookings.B_JobGroup = Teachers.T_JobGroupWHERE Bookings.B_BID = '1001'AND Teachers.T_Status = 'Live'AND Teachers.T_JobGroup = 'Teacher Secondary'
Second query:SELECT TOP 1 A_Colour FROM AvailabilityWHERE A_TID = '1016' AND A_AvailDate >= '2014-03-03'AND A_AvailDate <= '2014-03-07'GROUP BY A_ColourORDER BY COUNT(*) Desc
Essentially how I imagine it working is for each teacher returned by the first query, run the second query to determine the teachers availability...?Hope that makes sense....ThanksDaveEDIT:The link between the 2 tables is Teachers.T_TID = Availability.A_TID