文章詳情頁
mysql - 如何用數(shù)據(jù)庫中某時間字段的 ’時分秒’ 減去 早上九點(09:00:00) 得到分鐘數(shù)
瀏覽:217日期:2022-06-20 08:43:18
問題描述
我的SQL如下:
select right(oph.create_time,8) - ’09:00:00’ from xxxxx,
oph.create_time 為數(shù)據(jù)庫中的某個時間 例如: 數(shù)據(jù)為 2016-07-07 19:24:30
但是減出來的數(shù)據(jù)是小時,并且小于一小時的都記為0了,我需要的是分鐘數(shù),請問一下具體怎么操作?

問題解答
回答1:可以用這個 (datepart(hour,oph.create_time)-9)*60+datepart(minute,oph.create_time)代替你上面紅框中的部分,可以得到分鐘
相關(guān)文章:
1. 關(guān)docker hub上有些鏡像的tag被標記““This image has vulnerabilities””2. docker-compose中volumes的問題3. boot2docker無法啟動4. nignx - docker內(nèi)nginx 80端口被占用5. docker安裝后出現(xiàn)Cannot connect to the Docker daemon.6. dockerfile - 為什么docker容器啟動不了?7. docker容器呢SSH為什么連不通呢?8. node.js - antdesign怎么集合react-redux對input控件進行初始化賦值9. java - SSH框架中寫分頁時service層中不能注入分頁類10. 關(guān)于docker下的nginx壓力測試
排行榜

熱門標簽
網(wǎng)公網(wǎng)安備