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 column1 smaller or equal 5000 x = column1 + tax;
  • if column1 > 5000 x or y or z should have column1 value result

can me find sql query calculates x or y or z?

2

select column1, tax,     case when column1 <= 5000 column1 + tax          else column1     end amount yourtable 

Comments

Popular posts from this blog

sql - invalid in the select list because it is not contained in either an aggregate function -

Angularjs unit testing - ng-disabled not working when adding text to textarea -

How to start daemon on android by adb -