Wrox Home  
Search P2P Archive for: Go

  Return to Index  

sql_language thread: Comparing two query results


Message #1 by "carlos" <ccorre@c...> on Thu, 15 Feb 2001 19:55:06
--=====================_3258675==_.ALT
Content-Type: text/plain; charset="us-ascii"; format=flowed

You can use Nested Query like
Query 1: select apptinbox.apptinbox_id, apptinbox.appt_id,
appt.appt_id as appt from apptinbox, appt where
apptinbox.appt_id = appt.appt_id

Then
Query 2: select apptinbox_id from apptinbox WHERE appt_id not in
(select apptinbox.appt_id from apptinbox WHERE apptid=(select apptid from 
appt))

At 07:55 PM 2/15/01 +0000, you wrote:
>Hi, I'm looking for how to compare two sets of data:
>for example:
>
>Query1 select apptinbox.apptinbox_id, apptinbox.appt_id,
>appt.appt_id as appt from apptinbox, appt where
>apptinbox.appt_id = appt.appt_id
>
>returns: 285 records  (.i.e., 285 apptinbox_ids)
>
>Query2: select apptinbox_id from apptinbox
>
>returns: 289 records
>
>
>What would be the query to compare and extract the
>four records that are in  Query2 but not in Query1.
>These should have the same amount of records..
>
>I'm using SQL Server6.5..
>
>Thanks,
>
>Carlos
>


----------
Anita Gupta
Analyst Programmer
Biomedical Information Technologies
E403 SOM, Case Western Reserve University
10900 Euclid Avenue
Cleveland, OH 44106
Phone:  (xxx) xxx-xxxx
Fax:  (xxx) xxx-xxxx




  Return to Index