The following is ignoring the date range. Please could someone explain what is going wrong here? Not sure if some of the statement requires parenthesis around it but wouldn’t understand why anyhow.
WHERE
booking_date BETWEEN '2011-11-01' AND '2011-12-21'
AND booking_status = 'Confirmed'
OR booking_status = 'Cancelled'
OR booking_status = 'Rearranged'
AND invoice_number=''
ORDER BY booking_date ASC
This is probably what you want:
The added line breaks are just for easier reading. The important part is the parentheses.
Take a look at this page for an explanation of operator precedence: http://msdn.microsoft.com/en-us/library/ms190276.aspx