i was unable to make any sense of your query untill i re-formatted it --
Code:
SELECT *
FROM hire_order AS o
JOIN hire_order_products AS op
ON o.order_id = op.order_id
WHERE product_id = 2
AND (
( post_date BETWEEN ('2012-08-10') AND ('2012-08-14') )
OR ( home_date BETWEEN ('2012-08-10') AND ('2012-08-14') )
)
AND order_returned < 2
you say this isn't picking up orders that have been delivered before this and are still out on hire
unfortunately i can't see how "delivered before this" and "out on hire" are supposed to be implemented here
Bookmarks