一條資料指定欄位更新sql語句怎麼寫

2021-05-30 05:42:45 字數 637 閱讀 5072

1樓:匿名使用者

update 表名

抄 set 列名=更新的值 where 條件如 update table1 set name='jj' where id=1

如果要更新多列,只要update table1 set fristname='jj',lastname='tt' where id=1

2樓:匿名使用者

uedate 表名 set 列名=新值 where 條件(定位到行)!

怎樣寫sql語句 同一表根據某欄位相同就更新

3樓:發生等將發生

update table

set name_id = (select distinct name_id from table t where t.name = table.name and t.

name = 1)

where flag = 0

--當flag等於

bai0的時候

du更新zhi

--更新的值為:與當dao前name相同的,回並且答flag等於1的name_id

如何用update語句更新某個欄位,讓欄位值遞增?

sql查詢表中id最大的一條資料怎麼寫

你想搜尋欄位中最大的數?用這個select max column name from table name 應該加主鍵條件吧 select from table a where id select max id from table where key a.key and key n select ...

求一條sql語句

求score總和 select sum score from tablename求最大userid select max userid from tablename 你的意思沒說明白,是要求最大userid對應的score總和。select userid,sum score from tablena...

求一條sql語句

能夠實現,先查詢出兩條置頂的 然後再根據結果查普通的,declare fastness intset fastness 2 這裡是你的固定新聞數量。declare sql varchar 1000 set sql select top fastness from table union all se...