Dear zzz,
regarding ur question.. according to MySQL, ur code syntax is right, but according to PHP, it doesnt works..
SELECT DISTINCT * FROM T1
LEFT JOIN T2 ON ( T1.a1 = T2.a2 )
WHERE a1 = 'x'
the reason why u stil have duplicates is because u do not specificly state which field from which table as ur condition in WHERE clause.. PHP is very sensitive about this issue..
i give u example of my codes.. my MySQL syntax implemented in PHP codes..
$sQue = "Active";
$sSql = "SELECT DISTINCT customer.FullName, customerjob.JobName, customeragency.AgencyName, agency.OfficeAdd1, agency.OfficeAdd2, agency.OfficeAdd3, agency.SubdistrictName, agency.Postcode, agency.DistrictName, division.DivisionName FROM customer INNER JOIN customeragency ON (customer.CustomerID=customeragency.CustomerID) INNER JOIN agency ON (customeragency.AgencyName=agency.AgencyName) INNER JOIN district ON (agency.DistrictName=district.DistrictName) INNER JOIN division ON (district.DivisionCode=division.DivisionCode) INNER JOIN customerjob ON (customer.CustomerID=customerjob.CustomerID) INNER JOIN subdistrict ON (subdistrict.DistrictCode=district.DistrictCode)";
$sWhere = "customer.StatusCode = '" . $sQue . "'";
$sOrderBy = "agency.ProtocolRanking, agency.ACategoryName, agency.AgencyName, customer.TitleName, customer.FullName, customer.RaceName, customer.ReligionName, customer.StatusCode";
Regardless how many fields to be ordered and selected, the result are distinct - NO DUPLICATES.. i guaranteed you~~ :p
Hope this could help you in solving ur duplicates problems..
Have a gud day..
Regards, videxx 😃