subtracting one query from the other

From: Date: Thu, 27 Jun 2002 02:28:57 +0000
Subject: subtracting one query from the other
Groups: php.db 
Request: Send a blank email to php-db+get-20154@lists.php.net to get a copy of this message
Please help, I am stuck and my mind is frozen. I want to subtrack one query from the other. I have one query that brings all the records. The second gets another set of records. I want to subtract the second query from the first one . How do i do this? First query produces like 1000 records. Second has like 800 records i want to display the other 200 that dont exist in the first query. Please help. I have this but it is too slow and doesnt work in php but does in mssql. select distinct a.playlist, a.material_id, a.destination_locator, a.destination, a.air_time, a.traffic_duration, a.comment, a.title, a.device_name, m.media_locator as source_locator, m.medium_name as source from cch_dubber_dublist_view11 a left outer join lib_copy_view m on a.material_id=m.material_id where (A.material_id is not null) and (A.material_id <>'') and NOT EXISTS (
       select null
       from
          dev_device_view d
       inner join
            lib_copy_view c
       on
            d.device_name= c.medium_name
       where
           c.material_id = a.material_id
           AND c.media_locator = a.destination_locator
           AND d.device_name = a.device_name
) _________________________________________________________________ Send and receive Hotmail on your mobile device: http://mobile.msn.com

« previous php.db (#20154) next »