sql - inserting if in a select query -


how can ?

select    (if(sum(costo) > 0) sum(costo) else 0) expr1         tdp_notaspesesezb 

you want use case statement.

select    case when sum(costo) > 0 sum(costo)    else 0    end 'expr1'   tdp_notaspesesezb 

Comments

Popular posts from this blog

c++ - Convert big endian to little endian when reading from a binary file -

C#: Application without a window or taskbar item (background app) that can still use Console.WriteLine() -

unicode - Are email addresses allowed to contain non-alphanumeric characters? -