
Query
SELECT
DISTINCT ppl.id
FROM communities comm, lots l, permits p, plans pl, pubsite_plans ppl
WHERE l.community_id = comm.id
AND p.lot_id = l.id
AND p.plan_id = pl.id
AND pl.pubsite_group_id = ppl.id
AND comm.id =
AND ppl.active = 1
AND (l.status_sale = 2 OR l.status_sale IS NULL)
failed with error You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'AND ppl.active = 1
AND (l.status_sale = 2 OR l.status_sale IS N