Hi. I am having trouble after migrating an Access Database to MySQL. Basically the Access query I was using for my application was:
SELECT Periode.LibPeriode, PaysPeriode.RefPaysPeriode, PaysPeriode.DateDebut, PaysPeriode.DateFin FROM Periode INNER JOIN (Pays INNER JOIN PaysPeriode ON Pays.RefPays = PaysPeriode.RefPays) ON Periode.RefPeriode = PaysPeriode.RefPeriode WHERE ((Pays.RefPays = 1) AND (PaysPeriode.DateDebut>#7/2/02#)) ORDER BY Periode.libPeriode, PaysPeriode.DateDebut However this wouldn't work in MySQL so I altered it to read... SELECT Periode.LibPeriode, PaysPeriode.RefPaysPeriode, PaysPeriode.DateDebut,PaysPeriode.DateFin FROM Periode, PaysPeriode, Pays WHERE Pays.RefPays = PaysPeriode.Refpays AND Periode.RefPeriode = PaysPeriode.RefPeriode AND PaysPeriode.DateDebut > 20020207000000 AND Pays.RefPays = 1 ORDER BY Periode.libPeriode, PaysPeriode.DateDebut This is soo close to working but just not quite. The Access query just pulled out unique values for the Periode.LibPeriod field which was perfect. But the MySQL seems to pull them all out. I have tried GROUPING the result by the Periode.LibPeriode which gives me unique values in the field but I need the unique values with the highest startdate i.e. PaysPeriode.DateDebut but it always pulls out the first start date? Can anyone help? Thanks, Chris -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php