Home | Advertising Info5 USERS CURRENTLY ONLINE   
PowerASP
   Site Search Contact Us Sunday, May 12, 2024  

  Active TopicsActive Topics  Display List of Forum MembersMemberlist  Search The ForumSearch  HelpHelp
  RegisterRegister  LoginLogin
SQL Queries
 PowerASP Code Help Area : SQL Queries
Subject Topic: sql statement for sum Post ReplyPost New Topic
Author
Message << Prev Topic | Next Topic >>
mjunior
Newbie
Newbie
Avatar

Joined: November/06/2004
Location: Brazil
Online Status: Offline
Posts: 27
Posted: February/12/2005 at 8:44pm | IP Logged Quote mjunior

Hello there,

I'm trying to use the select sum in order to summary the total comission grouped by vendor name...
The statement goes well at start but it seems I'm only allowed to use the variables I choose to sum or grop instead have access to all...so I've some errors when I tried to response.write this vriables.

My sql is below:
"SELECT Sum (valorfinalproposta)AS comissao FROM tab_CadVendas WHERE fimcadvenda = 's' AND fimcadnotafisc = 's' GROUP BY indicaprojeto", conBD

Please help me.

__________________
mjunior(dumb)
Back to Top View mjunior's Profile Search for other posts by mjunior
 
chrscote
Newbie
Newbie


Joined: June/01/2005
Online Status: Offline
Posts: 3
Posted: June/02/2005 at 9:27am | IP Logged Quote chrscote

Include any fields you want to the SELECT statement either before the Sum(...) AS ... or after.  For example, to access all fields, you would write:

SELECT Sum(valorfinalproposta) AS comissao, fimcadvenda, fimcadnotafisc FROM tab_CadVendas WHERE fimcadvenda='s' AND fimcadnotafisc = 's' GROUP BY indicaprojeto"

Sum(valorfinalproposta) AS comissao acts as a single field in the SELECT statement.

Chris

Back to Top View chrscote's Profile Search for other posts by chrscote
 

If you wish to post a reply to this topic you must first login
If you are not already registered you must first register

  Post ReplyPost New Topic
Printable version Printable version

Forum Jump
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot delete your posts in this forum
You cannot edit your posts in this forum
You cannot create polls in this forum
You cannot vote in polls in this forum

   Active Server Pages Rule The World
Contact Us  
All artwork, design & content contained in this site are Copyright © 1998 - 2024 PowerASP.com and Christopher J. Williams
Banner ads ,other site logos, etc are copyright of their respective companies.
STATS Unless otherwise noted - All Rights Reserved.

vbscript active server pages ASP vbscript SQL database informix oracle SQL Server Perl CGI Delphi PHP source code code sample samples program CJWSoft ASPProtect ASPBanner ASPClassifieds www.aspprotect.com, www.cjwsoft.com,www.aspclassifieds.com,www.aspphotogallery.com