This query (yes, there is a join of one table to itself) works properly on the command line or using MySQL Query Browser, but fails when attempted in a PHP script
Code:
SELECT O.order_id, O.SKU, I2.misc3, I3.misc3, O.quantity, OS.date_placed
FROM INVENTORY AS I2
LEFT JOIN INVENTORY as I3 ON I2.parent_sku=I3.SKU,
ORDERLINES O
LEFT OUTER JOIN ORGANIZATION OG ON O.SKU=OG.SKU,
ORDERS OS
WHERE OS.date_placed >= '2006-09-20 15:00:01' AND O.status = 'Processing'
AND OG.category = '35482' AND OS.order_id=O.order_id AND I2.SKU=O.SKU
ORDER by SKU, O.order_id ASC;
I won't give this level of access to anybody else. Any suggestions on how to make it work as a script so that I can have others easily fetch the resulting report? (Ultimately needs to save results as a .csv)
Thanks,
Craig