• thank you all for assistance and support.

    --Jeff Moden

    If the user only has an "in" time on one day and an "out" time the next day, they may be a part time worker that worked through midnight (just as an example).

    My recommendation would be to repost some data you previously posted but include the "in/out" indicators provided by the timeclock machines.

    I've modified my post by adding column shows the "in/out" indicators provided by the timeclock machines.

    sometimes many users have two check outs or two checkins, it happens during the day when two users pass together from the gate and they using one card only.

    serg-52

    How do you want 'L' or '0' marks to be calculated? I couldn't find it in your post. So the script above calculates only '0'.

    The script is intended to produce a row for a month specified by the variables

    declare @year int = 2014;

    declare @month int = 11;

    thank you for providing the function.

    I've added the two tables for Holidays and leaves in my post above, can we make it to show "L" or "H"

    on the mentioned day for the employees?