Snetty
07-15-2008, 03:57 PM
A friend of mine is helping me out with some mysql, only problem is he's never touched mysql and is instead an ms-sql expert. Can anyone tell me/us whether this is still valid mysql as I'm getting syntax errors reported.
If not, could someone offer up the equivalent mysql syntax please?
SELECT c.customerid,
c.orderidprefix,
c.business,
c.email,
c.status,
activeorders.orders
FROM customers c
LEFT JOIN
(
SELECT f.customerid,
COUNT(*) [Orders]
FROM formorders f
WHERE f.status <> 'accepted/scheduled'
AND f.completion_date < '15/07/2008'
) [activeorders]
ON c.customerid = [activeorders].customerid
If not, could someone offer up the equivalent mysql syntax please?
SELECT c.customerid,
c.orderidprefix,
c.business,
c.email,
c.status,
activeorders.orders
FROM customers c
LEFT JOIN
(
SELECT f.customerid,
COUNT(*) [Orders]
FROM formorders f
WHERE f.status <> 'accepted/scheduled'
AND f.completion_date < '15/07/2008'
) [activeorders]
ON c.customerid = [activeorders].customerid