Solution 1:
SELECT cd_e_calls.bedrijfs_id AS gegevens_id, gebeld , status FROM cd_e_calls , cd_e_gegevens , cd_e_negatief WHERE cd_e_gegevens.RvV != '1' AND bedrijfs_id = ( SELECT cd_e_gegevens.id AS gegevens_id, COUNT(cd_e_calls.bedrijfs_id), MAX(cd_e_calls.gebeld) FROM cd_e_gegevens JOIN cd_e_calls ON cd_e_gegevens.id = cd_e_calls.bedrijfs_id JOIN cd_e_negatief ON cd_e_negatief.gegevens_id != cd_e_gegevens.id AND cd_e_calls.bedrijfs_id = cd_e_gegevens.id AND cd_e_negatief.gegevens_id != cd_e_gegevens.id HAVING COUNT(cd_e_calls.bedrijfs_id) = 2 HAVING MAX(cd_e_calls.gebeld) NOT LIKE '2009-08-25' GROUP BY cd_e_gegevens.id ORDER BY id DESC LIMIT 1 )
I receive te following error:
MySQL said:#1064 - 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 'HAVING MAX( cd_e_calls . gebeld ) NOT LIKE '2009-08-25' GROUP BY cd_e_gegevens ' at line 1
After changing the second HAVING with AND, I receive the following:
MySQL said:#1064 - 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 'GROUP BY cd_e_gegevens . id ORDER BY id DESC LIMIT 1 )
LIMIT 0, 30' at line 1I can't figure that out..
Solution2:
MySQL said:#1064 - 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 'HAVING MAX( cd_e_calls.gebeld ) NOT LIKE '2009-08-25'
)
ORDER BY id DESC
LIMI' at line 14After changing the second HAVING to AND:
MySQL said:#1241 - Operand should contain …