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

Update Query

P: 1
Expand|Select|Wrap|Line Numbers
  1. id               fname               lname            seniority
  2. 1                Kaur                Hardeep               1
  3. 2               Kaur                Hardeep                2
  4. 3                Kaur                Hardeep               3
  5. 4               Kaur                Hardeep                4
  6. 5                Kaur                Hardeep               5
  7. 6               Kaur                Hardeep                6
  8. 7               Kaur                Hardeep                7
  9. 8                Kaur                Hardeep               8

suppose i want to delete record # 4, then rest of the records has to be updated
5 should be 4 and so on.. i have my sql statement
Expand|Select|Wrap|Line Numbers
  1. UPDATE MemberData SET Seniority = Seniority-1
  2. WHERE (((Seniority)>[]));
i cant figure out what i should put instead of []. becuase i have to specify the deleted record and then update the records. so what i should put instead of [], so i wont get input message. everytime i delete record and click update. i get input message in where i have to specify what number i have deleted. is there any way i can specify my current deleted record instead of [].and rest of the records updates automatically.

Jun 13 '07 #1
Share this Question
Share on Google+
1 Reply

Expert Mod 15k+
P: 31,494
Try :
Expand|Select|Wrap|Line Numbers
  1. UPDATE MemberData
  2. SET Seniority = Seniority-1
  3. WHERE Seniority>4;
The value here would be the value of the Seniority field of the record just deleted.
Jul 4 '07 #2

Post your reply

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