سؤال

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;

هل كانت مفيدة؟

المحلول

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)

نصائح أخرى

Try this,

UPDATE tableName
SET colName = colName - 5   -- this will decrease the  value by 5
مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top