sum - SQL query command -
i new sql , need find command in order generate report regarding table have:
column1 tax amount 350 45 x 6500 53 y 800 25 z i need calculate x, y , z. need math:
=if(column1 <= 5000, column1 + tax, column1) in words: need calculate x/y/z sum of column1+tax options:
- if
column1smaller or equal 5000x = column1 + tax; - if
column1 > 5000x or y or z should havecolumn1value result
can me find sql query calculates x or y or z?
select column1, tax, case when column1 <= 5000 column1 + tax else column1 end amount yourtable 
Comments
Post a Comment