Hi Folk
I am trying to select all the fields from ACS and at the same time
check if in ACC there is a certain link to another table. This should
be expressed in the counter field. However, the query below doe not
work as it only selects ACS rows without any link in ACC (is null) or
ones with a link through to ACT.
Here is the sql:
SELECT `ACS` . * , COUNT( `ACC`.`ID` ) counter
FROM `ACS`
LEFT JOIN `ACC` ON `ACS`.`ID` = `ACC`.`ACS_ID`
WHERE
`ACC`.`ID` IS NULL OR
`ACC`.`ACT_ID` = "480"
GROUP BY `ACS`.`ID`
ORDER BY counter DESC , `NAM`
ACC has the following fields:
ACS_ID = link to ACS
ACT_ID = link to ACT
Right now, it only give me 13 rows - while ACS has about fifty rows in
it.
Cheers
Nicolaas