Scholieren.com forum

Scholieren.com forum (https://forum.scholieren.com/index.php)
-   Software & Hardware (https://forum.scholieren.com/forumdisplay.php?f=20)
-   -   MySQL snel optellen (https://forum.scholieren.com/showthread.php?t=586344)

eXo 01-09-2003 11:43

MySQL snel optellen
 
Is er ook een bepaalde methode waarmee ik in MySQL snel de waarde 1 bij een integer kan optellen?

Want als ik dat zou willen doen moet ik 2 queries uitvoeren, 1 SELECT om de huidige waarde op te halen, en 1 UPDATE om hem met 1 op te hogen. Dat moet makkelijker kunnen, niet?

eXo 01-09-2003 11:51

*zucht*

Ik ben ook zo'n knoopie..

Citaat:

If you access a column from tbl_name in an expression, UPDATE uses the current value of the column. For example, the following statement sets the age column to one more than its current value:

mysql> UPDATE persondata SET age=age+1;

UPDATE assignments are evaluated from left to right. For example, the following statement doubles the age column, then increments it:

mysql> UPDATE persondata SET age=age*2, age=age+1;
Bron MySQL.com :P

Triloxigen 01-09-2003 12:54

Je doet er iig wel moeite voor (y)


Alle tijden zijn GMT +1. Het is nu 19:04.

Powered by vBulletin® Version 3.8.8
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.