By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,648 Members | 1,572 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,648 IT Pros & Developers. It's quick & easy.

how does update work with 'not in'

P: 1
sample:
Expand|Select|Wrap|Line Numbers
  1. update tableA 
  2.    set flag = 'N' 
  3. where id not in 
  4.    (select id 
  5.     from tableA 
  6.     where flag = 'Y')
Q: how does this query work?
is system firstly get the list which falg is 'Y', then pick up each id and check if it's in the list, then update accordingly?

Or

is system pick up one id and get the list which flag is 'Y' everytime, then update accordingly?
Aug 12 '13 #1
Share this Question
Share on Google+
3 Replies


ck9663
Expert 2.5K+
P: 2,878
It sounds like it is...


~~ CK
Aug 12 '13 #2

Rabbit
Expert Mod 10K+
P: 12,430
I don't understand either one of your descriptions. What it's doing is if an id has a record in the table where the flag is set to Y, don't update that row. Update everything else to N.
Aug 12 '13 #3

P: 4
First statement is correct. firstly get the list which falg is 'Y'. then will check with all id's..
Aug 23 '13 #4

Post your reply

Sign in to post your reply or Sign up for a free account.