Sorting an Access Query on Date and Time DESC

I run an Access query on a table that sorts data by Date just fine, but I would like to sort it by Date and Time. The Date and Time are in separate columns.  Presently the results look like this;

4/9/2010       2:10 AM          (253) 292-xxxx          (951) 719-xxxx         Sent          --
4/9/2010       2:32 AM         (253) 292-xxxx         (951) 719-xxxx        Sent        --
4/8/2010       10:41 PM         (253) 292-xxxx         (951) 719-xxxx        Sent        --
4/8/2010       10:53 PM         (253) 292-xxxx         (951) 719-xxxx        Sent        --
4/8/2010       11:27 PM         (951) 719-xxxx         (253) 292-xxxx        Received        --
4/8/2010       11:28 PM         (253) 292-xxxx         (951) 719-xxxx        Sent        --
4/8/2010       11:34 PM         (951) 719-xxxx         (253) 292-xxxx        Received        --
4/8/2010       11:35 PM         (253) 292-xxxx         (951) 719-xxxx        Sent        --
4/8/2010       11:36 PM         (951) 719-xxxx         (253) 292-xxxx        Received        --
4/8/2010       11:37 PM         (253) 292-xxxx         (951) 719-xxxx        Sent        --
4/8/2010       11:43 PM         (951) 719-xxxx         (253) 292-xxxx        Received        --
4/8/2010       11:43 PM         (951) 719-xxxx         (253) 292-xxxx        Received        --
4/8/2010       11:45 PM         (253) 292-xxxx         (951) 719-xxxx        Sent        --
4/8/2010       11:46 PM         (951) 719-xxxx         (253) 292-xxxx        Received        --
4/8/2010       11:47 PM         (253) 292-xxxx         (951) 719-xxxx        Sent        --

My SQL to pull these results looks like this;

strSQL = "SELECT * FROM Phone WHERE Message_To = '951719xxxx' AND Message_From = '253292xxxx' OR Message_From = '951719xxxx' AND Message_To = '253292xxxx' ORDER BY Message_Date DESC, Message_Time"

What I would like the results to be has the Time DESC by latest time for the Date, like this;

4/9/2010       2:32 AM         (253) 292-xxxx         (951) 719-xxxx        Sent        --
4/9/2010       2:10 AM          (253) 292-xxxx          (951) 719-xxxx         Sent          --
4/8/2010       11:47 PM         (253) 292-xxxx         (951) 719-xxxx        Sent        --
4/8/2010       11:46 PM         (951) 719-xxxx         (253) 292-xxxx        Received        --
4/8/2010       11:45 PM         (253) 292-xxxx         (951) 719-xxxx        Sent        --
4/8/2010       11:43 PM         (951) 719-xxxx         (253) 292-xxxx        Received        --
4/8/2010       11:43 PM         (951) 719-xxxx         (253) 292-xxxx        Received        --
4/8/2010       11:37 PM         (253) 292-xxxx         (951) 719-xxxx        Sent        --
4/8/2010       11:36 PM         (951) 719-xxxx         (253) 292-xxxx        Received        --
4/8/2010       11:35 PM         (253) 292-xxxx         (951) 719-xxxx        Sent        --
4/8/2010       11:34 PM         (951) 719-xxxx         (253) 292-xxxx        Received        --
4/8/2010       11:28 PM         (253) 292-xxxx         (951) 719-xxxx        Sent        --
4/8/2010       11:27 PM         (951) 719-xxxx         (253) 292-xxxx        Received        --
4/8/2010       10:53 PM         (253) 292-xxxx         (951) 719-xxxx        Sent        --
4/8/2010       10:41 PM         (253) 292-xxxx         (951) 719-xxxx        Sent        --

I don't want to use a temp table and the result is posted on a .asp page.

<edited by SouthMod 04/10/2010 to obfuscate phone numbers in SELECT statement>
LVL 18
mgfranzAsked:
Who is Participating?

[Webinar] Streamline your web hosting managementRegister Today

x
 
jppintoConnect With a Mentor Commented:
strSQL = "SELECT * FROM Phone WHERE Message_To = '951719xxxx' AND Message_From = '253292xxxx' OR Message_From = '951719xxxx' AND Message_To = '253292xxxx' ORDER BY Message_Date DESC, Message_Time DESC"

0
 
mgfranzAuthor Commented:
Almost, but the results came out like this;

...
4/8/2010        5:25 PM           (951) 719-xxxx           (253) 292-xxxx          Received          --
4/8/2010       5:23 PM         (253) 292-xxxx         (951) 719-xxxx        Sent        --
4/8/2010       5:22 PM         (951) 719-xxxx         (253) 292-xxxx        Received        --
4/8/2010       5:21 PM         (253) 292-xxxx         (951) 719-xxxx        Sent        --
4/8/2010       5:11 PM         (951) 719-xxxx         (253) 292-xxxx        Received        --
4/8/2010       11:47 PM         (253) 292-xxxx         (951) 719-xxxx        Sent        --
4/8/2010       11:46 PM         (951) 719-xxxx         (253) 292-xxxx        Received        --
4/8/2010       11:45 PM         (253) 292-xxxx         (951) 719-xxxx        Sent        --
4/8/2010       11:43 PM         (951) 719-xxxx         (253) 292-xxxx        Received        --
4/8/2010       11:43 PM         (951) 719-xxxx         (253) 292-xxxx        Received        --
4/8/2010       11:37 PM         (253) 292-xxxx         (951) 719-xxxx        Sent        --
4/8/2010       11:36 PM         (951) 719-xxxx         (253) 292-xxxx        Received        --
4/8/2010       11:35 PM         (253) 292-xxxx         (951) 719-xxxx        Sent        --

Could the SQL be interpreting the time as a sequential number from 9 - 0?
0
 
jppintoCommented:
It can be interpreting the time as text...
0
All Courses

From novice to tech pro — start learning today.