Run Code
|
API
|
Code Wall
|
Users
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
Dividing runs by time stamp
CREATE TABLE Table1 ([strvalue] varchar(1), [eventtime] varchar(4)) ; INSERT INTO Table1 ([strvalue], [eventtime]) VALUES ('A', '1:00'), ('A', '1:05'), ('B', '1:10'), ('C', '1:15'), ('A', '1:20'), ('A', '1:25'), ('A', '1:30') ; SELECT max(eventtime) as maxTime , min(eventtime) as minTime , strvalue as PartNum FROM (SELECT * , ROW_NUMBER() OVER (ORDER BY eventtime desc) - ROW_NUMBER() OVER (PARTITION BY strvalue ORDER BY eventtime desc) as grouping FROM Table1) as t1 GROUP BY t1.grouping, t1.strvalue ORDER BY min(eventtime) desc
run
|
edit
|
history
|
help
0
Please
log in
to post a comment.
bc160402152
Students
sum vs count with multiple options in group by clause
Negociosj
SQL query to find difference in text between different rows
Shalvika's Query
FOREIGN KEY
join ans
OFFSET FETCH Clause
Second Query
Please log in to post a comment.