Guys,
Got this query...
---------------------------
SELECT TOP 5 Tbl_admin_hotel s.HotelName,
(SELECT COUNT(Tbl_marke ting_history.Ho telID)
FROM Tbl_marketing_h istory
WHERE Tbl_marketing_h istory.HotelID = Tbl_admin_hotel s.HotelID)
AS CountTotal,
(SELECT MAX(DateSent)
FROM Tbl_marketing_h istory
WHERE Tbl_marketing_h istory.HotelID = Tbl_admin_hotel s.HotelID)
AS LastSent
FROM Tbl_admin_hotel s
WHERE NOT Tbl_admin_hotel s.HotelID = 99
ORDER BY CountTotal DESC
---------------------------
Within the table Tbl_marketing_h istory there is also a 'Subject' column that
I require, the row to grab this Subject column from should relate to the row
I'm selecting in the SubQuery to grab 'DateSent'.
I've tried and tried to grab multiple columns but failed miserably? Can
anyone help pleaseeee!
Cheers, Ash
Got this query...
---------------------------
SELECT TOP 5 Tbl_admin_hotel s.HotelName,
(SELECT COUNT(Tbl_marke ting_history.Ho telID)
FROM Tbl_marketing_h istory
WHERE Tbl_marketing_h istory.HotelID = Tbl_admin_hotel s.HotelID)
AS CountTotal,
(SELECT MAX(DateSent)
FROM Tbl_marketing_h istory
WHERE Tbl_marketing_h istory.HotelID = Tbl_admin_hotel s.HotelID)
AS LastSent
FROM Tbl_admin_hotel s
WHERE NOT Tbl_admin_hotel s.HotelID = 99
ORDER BY CountTotal DESC
---------------------------
Within the table Tbl_marketing_h istory there is also a 'Subject' column that
I require, the row to grab this Subject column from should relate to the row
I'm selecting in the SubQuery to grab 'DateSent'.
I've tried and tried to grab multiple columns but failed miserably? Can
anyone help pleaseeee!
Cheers, Ash
Comment