My table is named users. I have a column named ID and module. Using mySQL syntax how can i say 'get the column id that equals 3 and update the column module to increment from its original number plus 1'
Asked
Active
Viewed 127 times
1
cnotethegr8
- 6,774
- 7
- 61
- 96
7 Answers
2
update users set module = module + 1 where id = 3;
Ray Baxter
- 3,152
- 22
- 25
-
Is your database case-insensitive? – Mathieu Rodic Jul 12 '11 at 22:08
2
Your question isn't super-clear, but is this what you want?!
UPDATE users
SET module = module + 1
WHERE ID = 3;
Paul Spangle
- 3,006
- 23
- 21
2
UDPATE users
SET module = module + 1
WERE ID = 3
What is it, homework? :-)
Mathieu Rodic
- 6,459
- 2
- 41
- 49
1
"UPDATE users SET module = module + 1 WHERE id=3";
That should get you what you want.
iLLin
- 739
- 3
- 7
1
To do it in MySQL:
UPDATE myDB.users SET module = module + 1 WHERE ID = 3
Do you need to know how to do this with php as well?
MoarCodePlz
- 4,915
- 2
- 22
- 32