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...
(Teachers.T_Title + ' ' +
Teachers.T_FName + ' ' +
Teachers.T_LName) AS Name,
INNER JOIN dbo.Teachers
ON Bookings.B_JobGroup = Teachers.T_JobGroup
WHERE Bookings.B_BID = '1001'
AND Teachers.T_Status = 'Live'
AND Teachers.T_JobGroup = 'Teacher Secondary'
SELECT TOP 1 A_Colour FROM Availability
WHERE A_TID = '1016'
AND A_AvailDate >= '2014-03-03'
AND A_AvailDate <= '2014-03-07'
GROUP BY A_Colour
ORDER 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....
The link between the 2 tables is Teachers.T_TID = Availability.A_TID