troubleshooting Question

Can you use a primary and secondary "order by" in SQL to arrange rows in a recordset?

Avatar of elliottbenzle
elliottbenzle asked on
ASPSQL
2 Comments1 Solution465 ViewsLast Modified:
I'm using ASP/MS access/dreamweaver.

I have a table which contains two fields, one with the date and one with the time. The order is all mixed up. Right now my SQL orders the data according to the date.

"SELECT * FROM hilliardmicroschedule ORDER BY vardate ASC"

But I'm running into the problem that when the dates are the same the times are still all mixed up. Is there a way to alter the SQL so that it orders by vardate first and then orders by vartime. The resulting recordset should be ordered primarily by date and when the dates are the same it will order by time. I'm assuming the code would look something like this:

"SELECT * FROM hilliardmicroschedule ORDER BY vardate ASC (AND ORDER BY vartime ASC)"

You can see the problem on this page under the first schedule (hilliard micro-mini) where the date order is fine but the times are all mixed up.

http://www.glowfishtw.com/flagfootball/schedules.asp?reg=hilliard

Thanks for any help.
ASKER CERTIFIED SOLUTION
Haris Dulic
Just an IT guy :)

Our community of experts have been thoroughly vetted for their expertise and industry experience.

Join our community to see this answer!
Unlock 1 Answer and 2 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 2 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros