Pregunta

I am bit novice regarding databases and I will highly appreciate any help given. I need to decrease all cells by X in one column of a table. Do I need to select the table and the column and use the value as variable like $value=$value +/- X;

¿Fue útil?

Solución

Well then simply do so by

UPDATE yourtablename SET columnname = columname-1

(if your column/cell is of a integer type this works fine) and dont enter a WHERE CLAUSE (updating all rows)

Otros consejos

Try this,

UPDATE tableName
SET colName = colName - 5   -- this will decrease the  value by 5
Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top