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

[SQL] Select with IF statement on postgresql

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

  1. Stack

    Stack Membro Participativo

    I have a code like that:

    ,COUNT(distinct tbl.project)
    ,if (tbl.stage like '%SIGNED%') then sum(tbl.value) else '0' end if as test
    my_table tbl
    group by

    And it returns me that error message:

    SQL Error [42601]: ERROR: syntax error at or near "then"

    I didn't got it. As I saw on documentation, the if statement syntax appears to be used correctly

    Continue reading...

Compartilhe esta Página