sql - Setting a running count for each occurance MySQL -


jack             8:00 may 10th jack            10:00 may 10th jack             1:00 pm may 10th bill             7:00 may 10th bill            11:00 may 10th diane            1:10 pm may 10th 

say have this, there way can set count each occurrence. in jack 1 8 am, 2 2nd occurrence @ 10am , 3 1pm. bill likewise, have first occurrence 1 7 , 2 11am.

so write case statement if xxx = odd clock in if xxx= clock out or if xxx= 1 clock in, xxx=2 out, xxx=3 in ect till 5 since never have 5 clock ins , outs in 1 day.

all of our time punches come in straight displayed, no in or out, fixing in month or 2 assign @ least along these line , part people follow clock in clock out format. if forgets, updated manager.

in table there few joins , unions, best option? or there easier way it? sample code.

select  lastname        ,firstname         , rownumber        (       select  @row_num := if(@prev_value=sa.lastname,@row_num+1,1) rownumber              ,sa.lastname              ,sa.firstname              ,@prev_value := sa.lastname         subadmins sa,              (select @row_num := 1) x,              (select @prev_value := '') y        order sa.lastname desc) subquery 


Comments

Popular posts from this blog

What is happening when Matlab is starting a "parallel pool"? -

angular - DownloadURL return null in below code -

php - Cannot override Laravel Spark authentication with own implementation -