LEFT JOIN Optimisation!
I have the following query:
I can't see anything wrong with the syntax however whenever I execute it I get a 500 Internal Server Error back from phpMyAdmin.
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
Firstly, is the syntax of this query correct?
Secondly, can it be optimized to perform correctly?
I think the JOIN has to come before the WHERE.
Yes, the WHERE should be the last thing before the ORDER BY in that query.
Originally Posted by triassic
"Please give us a simple answer, so that we don't have to think, because if we think, we might find answers that don't fit the way we want the world to be."
~ Terry Pratchett in Nation
How to Ask Questions the Smart Way
(not affiliated with this site, but well worth reading)
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)