sum in sql different to sum in Excel

  • I have some data in sql serve which I am trying to summarize with the following syntax:

    SELECT

    SUM(DATA) AS ENTITY_TOTAL

    ,HFM_ENTITY

    FROM dbo.vw_TotalAuditJournalID

    GROUP BY HFM_ENTITY

    When I export the view vw_TotalAuditJournalID into excel and do exactly the same thing via a pivot I get completely different results. DO you have any ideas why this may be happening?

  • In what way are the results different? What's the data type of the "DATA" column?

    Is HFM_ENTITY a character column? If so, do you have a case sensitive collation in SQL Server?

    Are you sure the whole table is exported to Excel? If you're using an old version (or are exporting using an older Excel driver), it will limit this to 65,536 rows...

  • My Apologies. I was counting the rows instead of summing them in the excel pivot. My Bad:blush:

  • eseosaoregie (10/11/2011)


    My Apologies. I was counting the rows instead of summing them in the excel pivot. My Bad:blush:

    That'd do it.

    We all have those moments.

    - Gus "GSquared", RSVP, OODA, MAP, NMVP, FAQ, SAT, SQL, DNA, RNA, UOI, IOU, AM, PM, AD, BC, BCE, USA, UN, CF, ROFL, LOL, ETC
    Property of The Thread

    "Nobody knows the age of the human race, but everyone agrees it's old enough to know better." - Anon

Viewing 4 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic. Login to reply