Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Several database Sql statements

2025-01-17 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)06/01 Report--

(1) there may be tare weight records of multiple cars in the same table. I want to update the earliest record, that is, to update their tare weight. In sqlite3, it is as follows:

Update CarNoTable set TareWeight = '9080'-where CarNO=' Beijing A6390' and TareWeight =-(select TareWeight from CarNoTable where CarNo=' Beijing A6390'-order by TareTime limit 0men5)

CarNoTable: tabl

TareWeight: tare field

CarNo: car number

TareTime: tare weight time

(2) convert the string field to an integer to find the largest record. Like multiple tare records of a vehicle, you want to find out the largest record.

Select max (cast (TareWeight as FLOAT)) from CarNoTable where CarNo = 'Beijing A6390'

(3) check the maximum tare weight and time

Select CarNo, TareWeight,TareTime from CarNoTable where cast (TareWeight as FLOAT) in (select max (cast (TareWeight as FLOAT)) from CarNoTable where CarNo=' Beijing A00A01')

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Database

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report