473,386 Members | 1,785 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

How to "ORDER BY" in descending order?

I have the following query in a combo box:

SELECT courses.courseCode, courses.courseDescription FROM courses ORDER BY
courseDescription;

I want to change the "ORDER BY" to display in descending order so the more
recent courses appear first on the list. How do I modify this query to
accomplish that end?

Thanks!

Rich Hollenbeck
Moreno Valley, CA USA
Dec 8 '06 #1
2 53973
Use DESC in the ORDER BY clause for a descending sort.

Assuming you have a CourseDate field so you can determine "more recent":
SELECT courses.courseCode, courses.courseDescription
FROM courses
ORDER BY CourseDate DESC, courseDescription;

--
Allen Browne - Microsoft MVP. Perth, Western Australia
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.

"Richard Hollenbeck" <ri****************@verizon.netwrote in message
news:6W9eh.782$qh.171@trnddc06...
>I have the following query in a combo box:

SELECT courses.courseCode, courses.courseDescription FROM courses ORDER
BY courseDescription;

I want to change the "ORDER BY" to display in descending order so the more
recent courses appear first on the list. How do I modify this query to
accomplish that end?

Thanks!

Rich Hollenbeck
Moreno Valley, CA USA

Dec 8 '06 #2
Use DESC in the ORDER BY clause for a descending sort.

Yes that did it. This is such a nice trick that I'm rewriting all my code,
wherever necessary, to include it.

Thank you very much!
Jan 3 '07 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

23
by: ian justice | last post by:
Before i post actual code, as i need a speedyish reply. Can i first ask if anyone knows off the top of their head, if there is a likely obvious cause to the following problem. For the moment i've...
1
by: Simon Wigzell | last post by:
Is it possible to retrieve data with ASP sorted on 2 fields? I've tried : SELECT * FROM ORDER By Field1 AND Field 2 But it gives an error. I've searched the internet on this topic to no avail....
1
by: Tamer Higazi | last post by:
Hi! I have problems creating joins between tables and to limit rows for a specified clolumn. I have 2 tables! employees departments I face the problems with the GROUP BY clause and i don't...
3
by: Ptbrady | last post by:
"Order By" fails in form for linked table. -------------- My A2K database has worked well for several years, but now has been split into front-end/back-end and has the following problem. I have a...
3
by: kartik | last post by:
Hi, I have a huge table with ID, Name and other info. ID can be either 1 or 2 or 3. I wish to create a query which sorts the data by ID, but in this order 2,1 and then 3. Is there any way to use...
0
by: Boris Zakharin | last post by:
I have a DataGrid based on a DataSet from an OleDbDataAdapter connected to an SQL Server 2000. There is a date field in the table I link to and I want to sort by it in descending order (latest...
7
by: Giles | last post by:
An ASP page outputs data from the query "Select ThisAndThat from comments WHERE pageURL='" & pageURL & "' ORDER BY threadID, datesent" (Access mdb) threadID is a string (OK, I know!), which means...
4
by: hadardo | last post by:
Hello. I read the Microsoft article about the sorting of negative deciaml values (http://support.microsoft.com/?id=837148), however, the problem wasn't solved. It works fine when I use a simple...
3
by: =?Utf-8?B?VmFuZXNzYQ==?= | last post by:
Here is my loop and it runs fine: ---------------------------------------------------- sSQL = "SELECT * FROM STORE_ITEMS" Set DataRec = DB.execute(sSQL) if not DataRec.EOF then do while not...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.