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 137 times
1

cnotethegr8
- 7,342
- 8
- 68
- 104
7 Answers
2
update users set module = module + 1 where id = 3;

Ray Baxter
- 3,181
- 23
- 27
-
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;

Andrew Carmichael
- 3,086
- 1
- 22
- 21
2
UDPATE users
SET module = module + 1
WERE ID = 3
What is it, homework? :-)

Mathieu Rodic
- 6,637
- 2
- 43
- 49
1
"UPDATE users SET module = module + 1 WHERE id=3";
That should get you what you want.

iLLin
- 759
- 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
- 5,086
- 2
- 25
- 31