Getting all 1’s that occur after a 3 in MySQL

I have a table that acts as a punch clock signing users in and out.

Out – 0
In – 1
Lunch – 2
Out On Business – 3

If someone signs out on business and then signs back in, it will issue a 3 and then 1 to sign them back in.

Whilst looking up total hours in a week, it’s looking for all in’s and outs but as there is an extra 1 after the 3 it skips the first.

Does anyone have any ideas on how to do this simply?

Thanks


Source: php

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.