SELECT orders.*, order_lines.*
WHERE DATE(orders.timestamp) BETWEEN '2009-04-01' AND '2009-06-30'
LEFT JOIN order_lines
ON orders.txn_id = order_lines.transaction_id
ORDER BY orders.timestamp ASC
I can't see anything wrong with the syntax however whenever I execute it I get a 500 Internal Server Error back from phpMyAdmin.
Firstly, is the syntax of this query correct?
Secondly, can it be optimized to perform correctly?