Web StuffWeb Scripts and ScriptingPlease rewrite sql

25 Aug 2009, 19:28

Hey guys, can anyone please rewrite this query for me to run quick?
It's working, but it takes too long 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

Rating 0 Comments 0
Reply

You have to login or register to post comments.

kish112
kish112
0 ♠ 0 ♣
Tweet:


Bookmark and Share