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#: Application without a window or taskbar item (background app) that can still use Console.WriteLine() -

c# - Making TableLayoutPanel Act Like An HTML Table (Cells That Resize Automatically Around Text) -