update語句可以搞定,但是需要join配合,
成都創(chuàng)新互聯(lián)是創(chuàng)新、創(chuàng)意、研發(fā)型一體的綜合型網(wǎng)站建設公司,自成立以來公司不斷探索創(chuàng)新,始終堅持為客戶提供滿意周到的服務,在本地打下了良好的口碑,在過去的10多年時間我們累計服務了上千家以及全國政企客戶,如成都木制涼亭等企業(yè)單位,完善的項目管理流程,嚴格把控項目進度與質量監(jiān)控加上過硬的技術實力獲得客戶的一致稱譽。
例如,有個表如下,需要將id =999對應的name改為id=1000對應的name
可以這么做:
1
update person t1 join (select id,name from person where id = 1000 limit 1 ) as t2 on t1.id = t2.id set t1.name = t2.name where t1.id = 999 and t2.id = 1000
修改后的結果
這樣就可以了。。
select count(*) from handup where unix_timestamp(hinserttime) (select unix_timestamp(max(hinserttime)) from handup) - 3600
如:
UPDATE ecs_goods SET integral = integral*0.01 WHERE cat_id in (1029,1025,1024,1023)
integral 字段需為數(shù)值型,不然會報錯。
--這樣是顯示的結果是差值總的秒數(shù)
select sum(unix_timestamp(B)-unix_timestamp(A)) as 秒數(shù)
from tb
--這樣是顯示成 xxx:xx:xx 的形式
select sec_to_time(sum(unix_timestamp(B)-unix_timestamp(A))) as ti
from tb
--
1.select a.商品名,(a.入庫數(shù)量-b.出庫數(shù)量)。
2.as 剩余數(shù)量 from 入庫表 a,出庫表 b。
3.where a.商品名=b.商品名。
可以這樣:
date('m',strtotime($date1))-date("m",strtotime($date2));
這樣就是你得到的兩個月份的差
新聞名稱:mysql怎么做減法運算 mysql加減運算
本文來源:http://www.chinadenli.net/article46/doojoeg.html
成都網(wǎng)站建設公司_創(chuàng)新互聯(lián),為您提供小程序開發(fā)、ChatGPT、App開發(fā)、網(wǎng)站設計公司、服務器托管、全網(wǎng)營銷推廣
聲明:本網(wǎng)站發(fā)布的內容(圖片、視頻和文字)以用戶投稿、用戶轉載內容為主,如果涉及侵權請盡快告知,我們將會在第一時間刪除。文章觀點不代表本網(wǎng)站立場,如需處理請聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內容未經(jīng)允許不得轉載,或轉載時需注明來源: 創(chuàng)新互聯(lián)