I am joining tables in mysql but I have one table that holds dates as so:
table: cutoff
date roomid
---------------------------
2012-11-03 25
2012-11-04 25
2012-11-05 25
2012-11-06 25
And here is my SQL query:
SELECT t.RoomId, t.USD, t.MXN, i.Image, a.RoomName, a.RoomDesc, cu.date FROM Tarifas AS t
INNER JOIN Images AS i ON i.RoomId = t.RoomId
INNER JOIN Availability AS a ON a.RoomId = t.RoomId
INNER JOIN cutoff AS cu ON cu.roomid = t.RoomId AND cu.date NOT BETWEEN '$from' and '$to'
WHERE t.Start <= '$from' AND t.End >= '$from' ORDER BY USD
I want to get all the rows where the date is not in the cutoff table. But it is giving me the opposite! I do not know what to do, any help here would be greatly appreciated!
EIDT TO ADD TARIFA TABLE:
table: tarifas
RoomId Start End USD MXN
---------------------------------------------------
25 2012-11-01 2012-11-20 60.00 620.00
26 2012-11-01 2012-11-20 80.00 820.00
27 2012-11-01 2012-11-20 55.00 570.00
Try this (edited):