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

MySQL select unique records from one table with two select queries using NOT IN

Discussão em 'Outras Linguagens' iniciado por Stack, Junho 17, 2021.

  1. Stack

    Stack Membro Participativo

    TaskNumber​
    JobNumber​
    Status​
    Date
    11111​
    JS0001​
    0​
    04-06-2021
    11112​
    JS0002​
    0​
    05-06-2021
    11113​
    JS0003​
    1​
    05-06-2021
    11114​
    JS0001​
    1​
    06-06-2021​

    Table Tasks. TaskNumber is the unique id(primary key). Status 0 is not done, 1 is done.

    example: JobNumber JS0001 assigned on 04th of june and not done, so reassigned on 06th of june and was completed(status 1)

    How do i get the unique job numbers that are not done using mysql query? (Only the Jobnumbers that are not completed for example JS0002 and not JS0001 on 04-06-2021)?

    I have tried following statement but it just shows all records where status is 0, is it possible to write two select statements and compare using NOT IN?

    SELECT DISTINCT Job_no FROM TASKS WHERE status='0'

    Thank you

    Continue reading...

Compartilhe esta Página