Hi, I have 2 dining rooms and orders, but my dining room structure is slightly different, in the order table there is a number, date, status, for example:
101,2012-12-10,0 101,2012-12-11,0 101,2012-12-12,1 101,2012-12-13,0 102,2012-12-10,0 102,2012-12-11,0 102,2012-12-12,0
and I would like to find available rooms between 2012-12-10 and 2012-12-13 according to this request, only number 102 should be returned.
I tried
SELECT id FROM status WHERE status='0' AND date between '2012-12-10' AND '2012-12-13' GROUP BY id
it does not work, because even finding only one available line, it returns true for 101
therefore 101 is available for 2012-12-11, and then appears as available, but is not suitable for our data range.
source share