Current location: Hot Scripts Forums » Programming Languages » ASP » Group by error:Expected end of statement


Group by error:Expected end of statement

Reply
  #1 (permalink)  
Old 01-28-10, 02:37 AM
jerrold jerrold is offline
New Member
 
Join Date: Jan 2010
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Group by error:Expected end of statement

hi...
i have an error to total my products in group by
any help please .....
this is my code what is wrong?

Code:
<BODY>
<%
 Set MyConn = Server.CreateObject("ADODB.Connection")
 MyConn.Open "FILEDSN=c:/dsn/MyTable_dsn.dsn"
 SQL_query = "SELECT products, SUM(sales) AS Totalsales"
 FROM Customer
 GROUP BY products;
 Set RS = MyConn.Execute(SQL_query)
 WHILE NOT RS.EOF
 %>
 
<br>
BAG: <%=RS("Total sales")%>
<br>

<%
 RS.MoveNext
 WEND
 RS.Close
 MyConn.Close
%>
</BODY>

Last edited by wirehopper; 01-28-10 at 06:48 PM. Reason: Code tags
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
  #2 (permalink)  
Old 01-28-10, 06:49 PM
wirehopper's Avatar
wirehopper wirehopper is offline
-
 
Join Date: Feb 2006
Posts: 2,516
Thanks: 20
Thanked 109 Times in 106 Posts
Move the quote to the end of the string.

SQL_query = "SELECT products, SUM(sales) AS Totalsales FROM Customer GROUP BY products";
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
  #3 (permalink)  
Old 01-29-10, 02:34 AM
jerrold jerrold is offline
New Member
 
Join Date: Jan 2010
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
thank wirehopper its works...

but if i write this code BAG: <%=RS("Totalsales")%> the display is
BAG: 2
BAG: 4

this is i want to be the out put
Red Bag: 2
Yellow Bag: 4
Total Bag: 6
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
  #4 (permalink)  
Old 01-29-10, 07:26 AM
wirehopper's Avatar
wirehopper wirehopper is offline
-
 
Join Date: Feb 2006
Posts: 2,516
Thanks: 20
Thanked 109 Times in 106 Posts
What are the other fields in your database?
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
[2005] StartPosition for CommonDialogs? tim8w Windows .NET Programming 10 01-08-09 04:39 AM
[SOLVED] searching through a grid view painthu ASP.NET 5 05-21-08 11:11 AM
TreeView Control - Background Image? tim8w Windows .NET Programming 1 04-11-07 01:43 PM
How to modify flash so it pulls php url every 15 seconds method Flash & ActionScript 7 03-05-07 07:39 AM
ASP upload prob minority ASP 1 06-27-05 09:35 AM


All times are GMT -5. The time now is 01:50 PM.
vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.