| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
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. |
|
#2
|
||||
|
||||
|
try this
Code:
sSQL = "SELECT clientID, cuttingMonth FROM clientCutting GROUP BY cuttingMonth, clientID ORDER BY cuttingMonth" |
|
#3
|
|||
|
|||
|
Wow! thanks for the quick reply
That seems to have done it. Thanks very much ![]() |
![]() |
| Viewing: ASP Free Forums > Programming > Code Bank > Something up with my SQL Statement |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|