Hi, can anyone please rewrite the following sql-query?
It's working, but it takes some time to execute.
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
FROM `cd_e_gegevens`
WHERE (
SELECT COUNT( `cd_e_calls`.`bedrijfs_id` )
FROM `cd_e_calls`
WHERE `cd_e_calls`.`bedrijfs_id` = `cd_e_gegevens`.`id` ) =2
AND (
SELECT MAX( `cd_e_calls`.`gebeld` )
FROM `cd_e_calls`
WHERE `cd_e_calls`.`bedrijfs_id` = `cd_e_gegevens`.`id`
) NOT LIKE '2009-08-25'
ORDER BY `id` DESC
LIMIT 1
)
AND `cd_e_negatief`.`gegevens_id` != `cd_e_gegevens`.`id`
LIMIT 1
I normally speak Dutch, but I don't think that really matters :)