Wrox Programmer Forums
Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP 3 Classic ASP Active Server Pages 3.0 > Classic ASP Basics
Classic ASP Basics For beginner programmers starting with "classic" ASP 3, pre-".NET." NOT for ASP.NET 1.0, 1.1, or 2.0
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Classic ASP Basics section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
Old July 19th, 2004, 11:59 PM
Authorized User
Join Date: Mar 2004
Posts: 84
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via AIM to gmoney060 Send a message via MSN to gmoney060
Default Sorty by Something, and then Sort by something els

I have a database that has many recordsets in it. I need to sort by one colemn and then by another. How do i do that?

Old July 20th, 2004, 12:22 AM
Friend of Wrox
Join Date: Jun 2003
Posts: 2,480
Thanks: 0
Thanked 1 Time in 1 Post

Are you looking for an SQL statement to do that? If so then use

Select * from somethingtable order by something asc, somethingelse desc,....

Desc - descending order
Asc - Ascending order (this is by default, so don't have to specify even.)

Hope that helps.

- Vijay G
Strive for Perfection
Old July 20th, 2004, 12:24 AM
Friend of Wrox
Join Date: Oct 2003
Posts: 463
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to madhukp

Hello gmoney60,

You can write the query as below.

SELECT <field_list> FROM <table> WHERE <condition> ORDER BY <sort field 1> [ASC | DESC], <sort field 2> [ASC | DESC]

<condition may be absent in which case you have to omit the Where part.

As an example

SELECT UserName FROM tblUsers WHERE UserStatus='0' ORDER BY DateOfBirth ASC, FirstName ASC

Similar Threads
Thread Thread Starter Forum Replies Last Post
Dynamic sort order or sort datatype kapy_kal XSLT 2 September 18th, 2007 02:10 PM
how to sort cross tab.sort based on row total joxa83 Crystal Reports 7 March 2nd, 2006 09:12 AM
Sort @* sheila XSLT 2 July 17th, 2005 04:01 PM
Unable to sort using xsl sort command sly_jimmy_boy XSLT 3 June 17th, 2005 05:15 AM
SORT pallone XSLT 13 February 25th, 2005 11:54 AM

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.