[thelist] sorting recordset problems

Pringle, Ron RPringle at aurora-il.org
Wed Jan 4 16:29:36 CST 2006


Asif-

Thanks for that, nice solution! I was going down a similar path when I
realized that the day portion of the file name wasn't written with leading
zeros in the case of a single digit day and decided the files needed to be
renamed for sanity's sake.

Your solution is what I originally had in mind though, so thanks for
fleshing it out! I'll store it away just in case.

Regards,
Ron


> Ron,
> 
> This is an interesting problem indeed. If the month is
> always characters 4 to 6 then I have a solution that
> will fix half of your problem. 
> 
> Create a new table called something like
> month_id(month_name, id) and populate with values like
> 
> 
> month_name    id
> Jan           1
> Feb           2
> Mar           3
> Apr           4
> 
> Now a SQL statement like the following will sort the
> files by month.
> 
> SELECT d.crazydate
> FROM date_test d, month_id m
> WHERE m.month_name = RIGHT(LEFT(d.crazydate, 6), 3)
> ORDER BY m.id
> 
> The date part could be solved with a similar approach
> I think. Will let you know if I figure it out.
 



More information about the thelist mailing list