ORDERING A MYSQL QUERY WITH JOINS AND GROUPS
Posted
by Oliver
on Stack Overflow
See other posts from Stack Overflow
or by Oliver
Published on 2010-04-29T11:56:19Z
Indexed on
2010/04/29
11:57 UTC
Read the original article
Hit count: 189
mysql
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?
© Stack Overflow or respective owner