Re: Comparing data in tables
From: Vishal Parkar (REMOVE_THIS_vgparkar_at_yahoo.co.in)
Date: 03/13/04
- Next message: ricky: "Re: Convert string to Number"
- Previous message: Chris: "Comparing data in tables"
- In reply to: Chris: "Comparing data in tables"
- Messages sorted by: [ date ] [ thread ]
Date: Sun, 14 Mar 2004 00:27:46 +0530
hi chris,
>>last+address+zip IN
(SELECT last+address+zip FROM do_not_mail);<<
do not use above clause, it will not be efficient because it will not use
any indexes on the columns last/address/zip. Try either of following
queries, should be efficient than what you are doing. Also make sure you
have indexes on these 3 columns in both the tables.
update consumer set mail_pander_flag='Y'
where exists
(select * from do_not_mail a
where a.last = consumer.last
and a.address = consumer.address
and a.zip = consumer.zip)
-- or --
update a set mail_pander_flag='Y'
from consumer a join do_not_mail b
on a.last = b.last
and a.address = b.address
and a.zip = b.zip
-- Vishal Parkar vgparkar@yahoo.co.in
- Next message: ricky: "Re: Convert string to Number"
- Previous message: Chris: "Comparing data in tables"
- In reply to: Chris: "Comparing data in tables"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|
|