I have a table
id|user_id|start|stop 1| 1| 1| 1 2| 2| 1| 1 3| 2| 1| 0 4| 3| 0| 0
I want to get next result
user_id|total|start|stop 1| 1| 1| 1 2| 2| 2| 1 3| 1| 0| 0
So i want to make 3 count and group it by user_id ang get. Is it possible to prepare query with Joins and without derived tables?
The total row as to count rows with 1 in
startand 1 instoptwice.