T
T
TechNOIR2020-05-15 21:00:48
MySQL
TechNOIR, 2020-05-15 21:00:48

How to make a query to get such a table?

There is a base with a table (an approximate view of the table on the screen is the upper table)
All data is written to it one after another. eventid 10 is user connection,
eventid 12 is disconnection.
How can I make a correct request to get the disconnect time next to the connection time in the adjacent column? (as in the screenshot - the bottom table)
5ebed8ce29890964985277.png

Answer the question

In order to leave comments, you need to log in

2 answer(s)
L
Lazy @BojackHorseman MySQL, 2020-05-15
Tag

LAG and LEAD functions

D
Dimonchik, 2020-05-15
@dimonchik2013

JOIN on itself

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question