Dette er din forespørgsel:
SELECT c.*, COUNT(d.servername) as servercount, d.controller
FROM customers C JOIN
customerdata d
ON c.id = d.customer
WHERE isVdi = :isVdi AND d.controller = :controller
GROUP BY d.customer
ORDER BY c.name ASC, c.environment ASC;
Desværre er alt = NULL
vil aldrig vende tilbage sandt. Endnu mere desværre understøtter MySQL ikke ANSI-standarden NULL
-safe comparator is not distinct from
. Men heldigvis har den et alternativ. Du kan prøve dette:
SELECT c.*, COUNT(d.servername) as servercount, d.controller
FROM customers C JOIN
customerdata d
ON c.id = d.customer
WHERE isVdi = :isVdi AND
d.controller <=> :controller
GROUP BY d.customer
ORDER BY c.name ASC, c.environment ASC;