Skip to main content
gamedev.net
🔒 Locked

SQL: Problem with SQL-86 commands

Started by boolean Apr 8, 2005 at 1:34 AM 1 replies 750+ views
Original Post
boolean
boolean
I'm not 100% sure if this is the best forum for this question, so if a mod wants to move it feel free. I am trying to get the following SQL query to work: SELECT FieldA, count(*) AS CountOfFieldB FROM Table WHERE FieldA <> ‘test’ GROUP BY FieldA ORDER BY CountOfFieldB DESC; Now, the problem is that the system I am working with only supports SQL-86, which is a pain. Because of this, I don't think the 'AS' command worked back then, sine the line "count(*) AS CountOfFieldB" throws an error about the word 'AS'. Does anyone know if there is another way of doing this without using the 'AS' syntax? Any idea how this would have been done in SQL-86? [Edited by - boolean on April 8, 2005 2:56:27 AM]
ucan_ordek
ucan_ordek
sorry, i don't have much time for... only i'll write the SQL statement.
SELECT FieldA, count(*)
FROM Table
WHERE FieldA <> 'Test' // you can use having with group
GROUP BY FieldA
ORDER BY 2 DESC, 1 ASC // 2: count(*), 1: FieldA
boolean
boolean
Awesome! That did the trick. Thanks mate [smile]

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.