4 Replies Latest reply on Sep 8, 2009 6:55 AM by TLC-IT

    SUM a SUM

    djkhalif Level 1

      Good morning All,

       

      I have an with SUM(tbl_Assembly_Production.UnitsProd) Total_Units. This returns a sum per record per date but, I need to sum that sum down to Totals. Is there an effect way to do this and output to Excel? I did try <cfset Totals = SUM(Total_Units)>

       

      Thanks in Advance,

       

      DJ Khalif

        • 1. Re: SUM a SUM
          djkhalif Level 1

          Ok,

           

          I am trying to resolve, I tried this <cfoutput>=SUM(C2:C11)</cfoutput> and, it works. But my table will grow as battery types are added. Any help?

           

          Thanks,

           

          DJ Khalif

          • 2. Re: SUM a SUM
            Dan Bracuk Level 5

            If tbl_Assembly_Production is a cold fusion query object, you can use either Q of Q

                 select sum (something) from etc

            or ArraySum.

                 x = arraysum(queryname["fieldname"])

            1 person found this helpful
            • 3. Re: SUM a SUM
              djkhalif Level 1

              Dan,

               

              I'll give that a shot. I ran into something issues. Data Integrity!!!!!!!! No matter how hard you work at something, you will always find other ways to work harder at it......... To improve it no doubt.

               

               

              Thanks,

               

              DJ Khalif

              • 4. Re: SUM a SUM
                TLC-IT Level 3

                You should do all of the sums and other summaries in an SQL query that references the appropriate table(s).  If you can't do the job in a single SELECT statement (I'll bet you can...) then you can use "subqueries" in SQL.

                 

                Let the database server do all of the hard work for you and send you only the results you need.  You don't want thousands or millions of records to "flow over the wire" just to be added-up.