I’m trying to pull some data out of an OLD database that is running on Win2000 Server SQL Server 2000 v8.00.760 but I’m getting an error. My Query is working in the current database that’s I’m using but I do not know what I’m doing that’s not backwards comparable, if that’s the problem.
Here’s my Query:
SELECT o.CustomerID, o.ShipName, o.ShipCity, o.ShipStateOrProvince, o.ShipPostalCode, o.ShipPhoneNumber, c.Profession, SUM( o.Total )
FROM Orders o
JOIN Customers c ON o.CustomerID = c.CustomerID
WHERE (o.OrderDate >= '2012-01-01')
AND (o.Void <> - 1)
AND (o.Cancelled <> - 1)
GROUP BY o.CustomerID
In MySQL it’s working fine. I’m getting the query back the way I want. But I get the error…

When I try it in the Older SQL version.
I’m sort of lost here now. Could anyone tell me what I’m doing wrong?
Thanks!
SQL Server is much stricter about GROUP BY than MySQL is. All non-aggregate columns from the SELECT clause must appear in the GROUP BY as well. Ths avoids the ambiguity that can occur when, for example, there are multiple ShipName values for a given CustomerID. While MySQL would arbitrarily choose one, SQL Server forces you to treat them as separate rows.