Get the App
SLTechnology News&Howtos  ›  Database  › 

How to customize the Analysis function least and date function by mysql

Shulou Source: shulou.com Published: 2022-05-31 14:01:11 10月03日 Update

Mysql how to define the analysis function least and date function, for this problem, this article introduces the corresponding analysis and solution in detail, hoping to help more partners who want to solve this problem to find a more simple and feasible method.

Mysql custom analysis function least and date function

For the needs of the project, because mysql does not provide an analysis function least, I wrote one. For your reference.

SELECT filename

Uarfcn

Cpi

DateTime

Str_to_date (dateTime,'% HRV% iRV% s.% f')

(select dateTime

From tdoas_scantest_cellerr tt

Where tt.filename = t.filename

And tt.uarfcn = t.uarfcn

And tt.cpi = t.cpi

And tt.id > t.id

Order by id limit 1) cc

Time_to_sec (timediff (str_to_date (dateTime,'% HRV% iRU% s.% f')

(str_to_date ((select dateTime

From tdoas_scantest_cellerr tt

Where tt.filename = t.filename

And tt.uarfcn = t.uarfcn

And tt.cpi = t.cpi

And tt.id > t.id

Order by id limit 1)

'% HRV% iRU% s.% f')) cc2

From tdoas_scantest_cellerr t

Where filename = '0702-main road Luoyu Road-4-122K-3 [1] .SCL.txt'

And cpi = 53

And uarfcn = 10055

Order by id

[@ more@]

A partial date function is attached.

Str_to_date: changing characters to dates

Timediff: take the difference between two dates

Time_to_sec: convert dates to seconds

The answer to the question about how mysql defines the analysis function least and date function is shared here. I hope the above content can be of some help to you. If you still have a lot of doubts to be solved, you can follow the industry information channel for more related knowledge.

Tags: Functions dates analysis questions more help answers easy easy two trunk trunk content characters guys buddies differences methods knowledge articles Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Shulou Information MySQL Xiaomi Redmi MariaDB