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

How to update table from same table?

P: 4
Hello all,

I'm not sure how to update table form same table. I've got this code so far, which doesn't work. :-/

Expand|Select|Wrap|Line Numbers
  2. SET Status = WIP2.Status
  3. FROM WorkInProgress AS WIP
  4. JOIN WorkInProgress AS WIP2
  6. WHERE WIP.wipDate = LastDate
  7. AND WIP2.wipDate = DateBeforeLastOne
  8. AND WIP.Status IS NULL;
Any ideas on that one?
Thank you :o)
Jul 17 '10 #1
Share this Question
Share on Google+
2 Replies

P: 4
hello again,

I modified by this example and it's working fine now :)

Expand|Select|Wrap|Line Numbers
  1. UPDATE M_Emp as A
  2. INNER JOIN M_Emp as B ON A.Emp_ID = B.Emp_ID
  3. SET A.Salary = B.Salary*1.1 
Jul 17 '10 #2

Expert 2.5K+
P: 3,072
Even easier:

Expand|Select|Wrap|Line Numbers
  1. UPDATE M_Emp as A SET Salary = Salary*1.1 
But puzzled why you change a status field....

Jul 17 '10 #3

Post your reply

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