Code Bank
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
 
User Name:
Password:
Remember me
Go Back   ASP Free ForumsProgrammingCode Bank

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread ASP Free Forums Sponsor:
  #1  
Old June 18th, 2004, 08:08 AM
poab poab is offline
Registered User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Jun 2004
Location: UK
Posts: 3 poab User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Something up with my SQL Statement

Hi (Apologees if this is the wrong section to post this in. I know it's an sql thing, but the sql bit looked a bit more advanced than this question.)


I'm really up against it for time and something seems to have gone horribly wrong with accessing records in a database. I'm not that experienced with ASP so frankly, I'm at a loss as to how to fix the problem. If there's anyone who knows what it is I'd really appreciate the help.

Here's what I've got:

Code:
Dim sSQL
sSQL = "SELECT clientID, cuttingMonth FROM clientCutting GROUP BY cuttingMonth ORDER BY cuttingMonth"


Now that works on a different database on the same site (with different field names). What I get now is this error:


Microsoft OLE DB Provider for ODBC Drivers error '80040e14' [Microsoft][ODBC Microsoft Access Driver] You tried to execute a query that does not include the specified expression 'clientID' as part of an aggregate function.

If I remove the GROUP BY and the ORDER BY bits of the statement like this:
Code:
Dim sSQL
sSQL = "SELECT clientID, cuttingMonth FROM clientCutting"

...it works, and both clientID and cuttingMonth are brought down from the database and used later in the script. Equally if I remove the clientId bit like so:
Code:
Dim sSQL
sSQL = "SELECT cuttingMonth FROM clientCutting GROUP BY cuttingMonth ORDER BY cuttingMonth"

...it also works, but of course, I don't then have access to the clientID in the database, which I really do need.

If anyone could tell me where I've gone wrong, or at least point me in the right direction I'd really appreciate it.

Thanks.


Reply With Quote
  #2  
Old June 18th, 2004, 08:28 AM
Memnoch's Avatar
Memnoch Memnoch is offline
Unholy Moderator
ASP Free God 14th Plane (11500 - 11999 posts)
 
Join Date: Oct 2003
Location: In hell, where did you think?
Posts: 11,760 Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level) 
Time spent in forums: 3 Weeks 5 Days 5 h 22 m 16 sec
Reputation Power: 443
try this
Code:
sSQL = "SELECT clientID, cuttingMonth FROM clientCutting GROUP BY cuttingMonth, clientID ORDER BY cuttingMonth"

Reply With Quote
  #3  
Old June 18th, 2004, 08:32 AM
poab poab is offline
Registered User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Jun 2004
Location: UK
Posts: 3 poab User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Wow! thanks for the quick reply

That seems to have done it.

Thanks very much

Reply With Quote
Reply

Viewing: ASP Free ForumsProgrammingCode Bank > Something up with my SQL Statement


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 2 hosted by Hostway