Results 1 to 2 of 2

Thread: Inserting SELECT SUM(...) AS Total?

  1. #1
    Ted Moore Guest

    Inserting SELECT SUM(...) AS Total?

    Dear Forum,

    This is a variation on the question I submitted 3/5/01. Instead of a running total, all I really need is a sum. Can I insert the SUM() aggregate function into the dbSQL statement and somehow export it?

    I was trying something like:

    MyDb.dbSQL="Select ItemName,ItemCode,quantity,ItemTotal,(SUM(ItemTota l) AS runningtotal) FROM qryViewCart WHERE SessionID=" & session("sessionID&#34

    Am I on the right track? Thanks in advance, Ted Moore

  2. #2
    FRANK KWONG Guest

    Inserting SELECT SUM(...) AS Total? (reply)

    Your SQL doesn't make sense. You return individual fields and also a SUM()? Should it be like -> SELECT SUM(quantity) as SQTY,..., SUM(ItemTotal) AS runningtotal .....
    Without knowing what you are try to get, I assume you want to export the totals of the Grid and display them at the bottom. If so, try using the designer to do that. It'll both display the aggregates as well as exprot them. Note that the export is for the time you do not have any control like returning RS from an SP in which you have no control to do SQL SUM(). In that case ASP-db will sum them as it is begin displayed. In that way It'll also sum a string field as VAL(Field) !!

    FK


    ------------
    Ted Moore at 3/7/01 6:17:57 PM

    Dear Forum,

    This is a variation on the question I submitted 3/5/01. Instead of a running total, all I really need is a sum. Can I insert the SUM() aggregate function into the dbSQL statement and somehow export it?

    I was trying something like:

    MyDb.dbSQL="Select ItemName,ItemCode,quantity,ItemTotal,(SUM(ItemTota l) AS runningtotal) FROM qryViewCart WHERE SessionID=" & session("sessionID&#34

    Am I on the right track? Thanks in advance, Ted Moore

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •