database - Preferred syntax for adding SQL SUMs together -


To say that I want to return the total sales, Unit Pays + Tax Amount, for the entire data set, I call the SQL query I can send back in two different ways with the same result.

or

  SELECT from the total sale of sales as a SELECT SUM (Unit Piece + Tax Amount) SUM (Unit Paris) + SUM (Tax Amount) Sales from AS 'Total Sales'  

Does any one of these questions reflect on other (performance or otherwise)? Or is it just a matter of taste?

Use:

   SUM (UnitPix + tax) AMOUNT) using   can return  

... as "Total Sales" by SUM (SUM) + SUM (tax amount) NULL If you have more than one value, you can wrap them in COALESCE:

  SELECT SUM (COALESCE (UNITESPICE, 0) COALESCE (tax amount, 0))  

update

I do not see any difference between the two methods, and considering that SUM () + SUM () more secure Damage, it confiscates deal for me.


Comments

Popular posts from this blog

Eclipse CDT variable colors in editor -

AJAX doesn't send POST query -

wpf - Custom Message Box Advice -