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

[SQL] Using multiple conditions in where clause of SQL Server

Discussão em 'Outras Linguagens' iniciado por Stack, Novembro 4, 2024 às 00:12.

  1. Stack

    Stack Membro Participativo

    I have a table called finalres in my database which has list of statuses and accounts.

    I want to pull the accounts where the status should not be in:

    (xxx, ina, nfc)


    Also I want to pull the accounts where the status in RWD but only when account# is null. I wrote the below query but it only giving result for either one condition. please help me.

    select *
    from finalres
    where 1 = 0
    or (status = 'rwd' and account# is null)
    or status not in ('xxx', 'ina', 'nfc')

    Continue reading...

Compartilhe esta Página