You are here: Re: [PHP] sort by date « PHP « IT news, forums, messages
Re: [PHP] sort by date

Posted by William Stokes on 05/09/05 11:12

Thanks Richard.

That did the trick. Now to the DB fixing business...

-Will

"Richard Lynch" <ceo@l-i-e.com> kirjoitti
viestissδ:3955.24.136.1.28.1115610399.squirrel@www.l-i-e.com...
> On Thu, May 5, 2005 10:42 pm, William Stokes said:
>> I made a mistake and stored date information to DB as varchar values
>> (dd.mm.yyy). When I read the DB is it still possible to sort the data by
>> date with SQL query (ORDER BY date ASC)? Or is it nessessary to have the
>> date information to be stored as a date in the DB? Will it work or is the
>> output going to be sorted randomly?
>
> As noted, your best solution is to fix the database.
>
> A short-term hack would be to:
> order by substring(your_field, 6, 4), substring(your_Field, 3, 2),
> substring(your_field, 1, 2)
>
> Read the MySQL manual to check the actual numbers for substring in MySQL
>
> --
> Like Music?
> http://l-i-e.com/artists.htm

 

Navigation:

[Reply to this message]


УдалСнная Ρ€Π°Π±ΠΎΡ‚Π° для программистов  •  Как Π·Π°Ρ€Π°Π±ΠΎΡ‚Π°Ρ‚ΡŒ Π½Π° Google AdSense  •  England, UK  •  ΡΡ‚Π°Ρ‚ΡŒΠΈ Π½Π° английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Π‘Π°ΠΉΡ‚ ΠΈΠ·Π³ΠΎΡ‚ΠΎΠ²Π»Π΅Π½ Π² Π‘Ρ‚ΡƒΠ΄ΠΈΠΈ Π’Π°Π»Π΅Π½Ρ‚ΠΈΠ½Π° ΠŸΠ΅Ρ‚Ρ€ΡƒΡ‡Π΅ΠΊΠ°
ΠΈΠ·Π³ΠΎΡ‚ΠΎΠ²Π»Π΅Π½ΠΈΠ΅ ΠΈ ΠΏΠΎΠ΄Π΄Π΅Ρ€ΠΆΠΊΠ° Π²Π΅Π±-сайтов, Ρ€Π°Π·Ρ€Π°Π±ΠΎΡ‚ΠΊΠ° ΠΏΡ€ΠΎΠ³Ρ€Π°ΠΌΠΌΠ½ΠΎΠ³ΠΎ обСспСчСния, поисковая оптимизация