Home > database >  My SQL time close 2 data comparison
My SQL time close 2 data comparison

Time:10-05

Table # T
ID order_date type
AA 20190101 sale
AA 20190301 return
AA 20190501 sale
AA 20190601 sale
BB 20190101 sale
BB 20190101 sale
The same ID, time close to each other once, if the type change, the extracted after a time

The results
ID order_date
AA 20190301
AA 20190501
  • Related