Yahoo Answers is shutting down on May 4th, 2021 (Eastern Time) and beginning April 20th, 2021 (Eastern Time) the Yahoo Answers website will be in read-only mode. There will be no changes to other Yahoo properties or services, or your Yahoo account. You can find more information about the Yahoo Answers shutdown and how to download your data on this help page.
Trending News
ORDER BY SQL statement not working?
I'm am using this SQL statement on my .asp (classic) page to order records by their server name:
SELECT *
FROM ProdServers
ORDER BY Server Name / OS / DNS Alias
But it is returning these two errors:
When I click test (ultradev):
[Microsoft][ODBC Microsoft Access Driver] Syntax error (missing operator) in query expression 'Server Name / DNS Alias'
When I try and test it on the server I get this error
Microsoft OLE DB Provider for ODBC Drivers error '80040e14'
[Microsoft][ODBC Microsoft Access Driver] Syntax error (missing operator) in query expression 'Server Name / OS / DNS Alias'.
/SORTTESTprod_servers.asp, line 10
It doesn't make any sense that it wants line 10 because:
ecordset1.Open() ??
What are your thoughts?
Oh, I'm using a Microsoft 2000 Database, and the primary key column is ID
Oh shoot, aha, I guess that would be the problem, its just one of those days! Thanks guys =)
I can't believe I forgot brackets! lol.
No comma's wouldn't do anything because that's the title of the column Server Name / OS / DNS Alias. I know that much! lol.
6 Answers
- hsueh001Lv 52 decades agoFavorite Answer
Try:
I'm assuming MS Access 2000 and not MS SQL Server 2000?
SELECT *
FROM [ProdServers]
ORDER BY [Server Name/OS/DNS Alias]
- 2 decades ago
Order by clause should be separated by comma.
e.g., ORDER BY Server Name, OS, DNS Alias
try this let me know
- ArbitrageLv 72 decades ago
I'm not an expert by any means, but the order by looks fishy with the slashes. I doubt that your column is named that. Maybe you wanted to have a primary, secondary, and tertiary sort and they should be delimited by commas instead?
- Anonymous2 decades ago
SELECT * FROM ProdServers ORDER BY [Server Name], [OS], [DNS Alias]
- How do you think about the answers? You can sign in to vote the answer.
- 2 decades ago
The ORDER BY has to have the name of the field and the sorting order ASCENDING or DESCENDING and use commas to seperate each field.
Eg. ORDER BY name ASC, regno DESC;