Results 1 to 4 of 4
Thread: viewing records ordered by date
- 07-30-2008, 10:43 AM #1
Member
- Join Date
- Jun 2008
- Posts
- 4
- Rep Power
- 0
viewing records ordered by date
actually i have inserted the "date" in msaccess database table using "dd-mm-yy" format
now i want to view records of that table in ascending order of the date
so i wrote the query:
Select * from TRANSACTIONS order by aco_date ASC,aco_time ASC";
but the problem is if i write this it compares the day first and then the month and then the year since i have inserted the date in dd-mm-yy
but logically it should compare the year first then the month and then the day...hw can i do that?
- 07-30-2008, 11:25 AM #2
Senior Member
- Join Date
- Jun 2008
- Posts
- 2,366
- Rep Power
- 7
By defining the column as a Date column in the DB rather than a varchar column.
A stop-gap solution is to use the to_date SQLFunction on the columns.
- 07-31-2008, 05:44 AM #3
Even if you want to store the string characters rather than as a Date, which is much better in all cases, you don't want to store it as MM-dd-YY or dd-MM-yy for a very simple reason:
you can't do arithmetic or comparisons on it. Store it as YYYYMMDD and then you can do trivial sorting, comparisons, etc.
- 07-31-2008, 07:14 AM #4
Member
- Join Date
- Jun 2008
- Posts
- 4
- Rep Power
- 0
Similar Threads
-
Creating a Gregorian Calendar using a Date object gives date - 1
By prachi_goliwadekar in forum New To JavaReplies: 1Last Post: 05-08-2008, 08:32 PM -
Difference between current date and anothe date
By vijay balusamy in forum New To JavaReplies: 1Last Post: 04-16-2008, 04:15 PM -
Getting number of records (JDBC 2.0)
By Java Tip in forum Java TipReplies: 0Last Post: 02-11-2008, 08:51 AM -
Number of updated records
By Java Tip in forum Java TipReplies: 0Last Post: 01-21-2008, 04:32 PM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks