mendizalea's avatar

Doubt about how to calculate a value in the classification

I have a table with these fields:

id	event_id	race_id	user_id	start_time	finish_time	inverted_time
1	1	1	1	10:10:00,000	10:25:00,000	00:15:00,000
2	1	1	2	10:11:00,000	10:25:58,000	00:14:58,000
3	1	1	3	10:12:00,000	10:25:22,000	00:13:22,000
4	1	2	1	12:00:00,000	12:10:00,000	00:10:00,000
5	1	2	2	12:01:00,000	12:15:00,000	00:14:00,000
6	1	2	3	12:02:00,000	12:19:00,000	00:17:00,000
7	1	3	1	13:00:00,000	13:24:00,000	00:24:00,000
8	1	3	2	13:01:00,000	13:22:00,000	00:21:00,000
9	1	3	3	13:02:00,000	13:35:01,000	00:33:01,000

It is to create a classification of an event which has several races. I would now like to know the positions that each user is ahead or behind in the event classification compared to the previous day/race. But I don't know how the best way to do it would be.

position	user_id	inverted_time
		RACE 1
1	3	00:13:22,000
2	2	00:14:58,000
3	1	00:15:00,000
		
		GENERAL AFTER RACE 1
1	3	00:13:22,000
2	2	00:14:58,000
3	1	00:15:00,000

position	user_id	inverted_time	
		RACE 2	
1	1	00:10:00,000	
2	2	00:14:00,000	
3	3	00:17:00,000	
			
		GENERAL AFTER RACE 1/2 	
1	2	00:25:00,000	+1
2	3	00:28:58,000	-1
3	1	00:30:22,000

position	user_id	inverted_time	
		RACE 3	
1	2	00:21:00,000	
2	1	00:24:00,000	
3	3	00:33:01,000	
			
		GENERAL AFTER RACE 1/2/3	
1	1	00:49:00,000	+2
2	2	00:49:58,000	-1
3	3	01:03:23,000	-1

What is interesting is what they see in the general classifications, show the +X or -X to each user.

Thanks

0 likes
0 replies

Please or to participate in this conversation.