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

  2. Anuncie Aqui ! Entre em contato fdantas@4each.com.br

[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:

    [​IMG]

    After insert, I have the following data in tbl_A:

    [​IMG]

    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:

    [​IMG]

    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