|
|||||||
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
#1 |
|
Member (10 bit)
|
I am having a problem that I know I've had before but don't know the resolution. I don't do a count of records very often within a database so it's not really fresh in my mind. Here is what I am seeing after doing a response.write of the strSQL and it producing the error...
Code:
SELECT Count(OutageID) As intRecords, OutageID FROM Outages ORDER by OutageID Microsoft JET Database Engine error '80040e21' You tried to execute a query that does not include the specified expression 'OutageID' as part of an aggregate function. ? |
|
|
|
|
|
#2 |
|
Member (9 bit)
Join Date: Dec 1999
Location: Midland, NC, USA
Posts: 292
|
Here's the deal: you aliased the count as intRecords. intRecords is the only column that will be returned by the query. That means that the ORDER BY needs to sort by intRecords.
As a note: if you would not have aliased the count (would have left out the "as intRecords"), you would still be returning one column. But it wouldn't have a name. |
|
|
|
|
|
#3 |
|
Member (10 bit)
|
Thank you. I have it working now.
|
|
|
|
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|