ORDERING A MYSQL QUERY WITH JOINS AND GROUPS
- by Oliver
I have this mysql query:
SELECT *
FROM Customer c
JOIN eHRDemographic ehD ON ehD.CxID = c.CustomerID
JOIN CustPrimaryWeight cpW ON cpW.CxID = c.CustomerID
WHERE c.CustomerID =22703
GROUP BY c.CustomerID
ORDER BY cpW.CustPrimaryWeightID DESC
This doesn't really work correctly as the CustPrimaryWeight table has multiple enteries and it's simply joining the first entry and not the more recent one as the ORDER statement doesn't seem to do anything.
Any ideas?