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

[SQL] Extending a SQL WHERE clause based on a condition

Discussão em 'Outras Linguagens' iniciado por Stack, Outubro 9, 2024 às 17:13.

  1. Stack

    Stack Membro Participativo

    I want to extend a WHERE condition based on the value of a field. Trying this but t2.field3 is unable to be bound. Is my syntax wrong?

    SELECT * FROM table_one t1
    JOIN table_two t2 on t1.field = t2.field
    WHERE table_one.field2 = "value"
    SELECT CASE WHEN t2.field3 IS NOT NULL THEN 'AND t2.field3 = 8'

    Continue reading...

Compartilhe esta Página