Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

recordset order problem

Status
Not open for further replies.

grohl

Programmer
Joined
Oct 2, 2001
Messages
1
Location
NL
I use the following script to get data from an MS Access database:

Set rs = Server.CreateObject("ADODB.Recordset")
sSQL = "SELECT DISTINCT name, SUM(hits) FROM tablename GROUP BY name"
rs.open sSQL, cn, 3, 3

What I would like to do is order the results by SUM(hits).
How can I do that?
 
sSQL = "SELECT DISTINCT name, SUM(hits) AS sumOfHits FROM tablename GROUP BY name ORDER BY sumOfHits"
penny.gif
penny.gif
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top