1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

[SQL] Check whether an employee is present on three consecutive days

Discussão em 'Outras Linguagens' iniciado por Stack, Setembro 10, 2021.

  1. Stack

    Stack Membro Participativo

    I have a table called tbl_A with the following schema:


    After insert, I have the following data in tbl_A:


    Now the question is how to write a query for the following scenario:

    • Put (1) in front of any employee who was present three days consecutively
    • Put (0) in front of employee who was not present three days consecutively

    The output screen shoot:


    I think we should use case statement, but I am not able to check three consecutive days from date. I hope I am helped in this

    Thank you

    Continue reading...

Compartilhe esta Página