I think I fried my brain, can someone help?
The following select statement queries two tables, returns the results from both, and sorts them first, according to status, then by notes, then by lastname. It all works just spiffily, but if there is a record that has two "notes" written for it, the results will display the same record twice. I'd like it to show it only once. Is there something I should be adding to the select statement?
$query = "SELECT Table_A.id
, Table_A.LastName
, Table_A.FirstName
, Table_A.Phone1
, Table_A.city1
, Table_A.city2
, Table_A.city3
, Table_A.phone1
, Table_A.phone2
, Table_A.phone3
, Table_A.lastname
, Table_A.status
, COALESCE(Table_B.notes, '') AS notes
FROM Table_A
LEFT JOIN Table_B ON (Table_B.id = Table_A.id)
WHERE (Table_A.county LIKE ('$cy%'))
ORDER BY Table_A.status DESC, notes DESC, Table_A.LastName ASC";
The answer is probably obvious, but I'm about ready to keel over and pass out from fried-brain disease, so your help is appreciated.