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

List<T>().Add problem C# -

Javascript natural sort array/object and maintain index association -