Domanda

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;

È stato utile?

Soluzione

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)

Altri suggerimenti

Try this,

UPDATE tableName
SET colName = colName - 5   -- this will decrease the  value by 5
Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top