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

Posted by William Stokes on 09/27/08 11:15

Ok tested this and it won't work. Next question is sql question but
anyway...

Can I use STR_TO_DATE() or GET_FORMAT(DATE,'EUR') to query and sort dates
to web page as a date even if the data is just a string in the db? Probably
with GET_FORMAT(DATE,'EUR') it wont work cause it's a varchar field in the
DB.

Any idea how to put STR_TO_DATE() in to the following SQL query:

SELECT event_id,name,date,time,place,type,info FROM test_table
WHERE (group = '$group') AND (type = 'Game' OR type = 'training')
ORDER BY date ASC

Thanks a lot
-Will



"William Stokes" <kalles@operamail.com> kirjoitti
viestissδ:20050506054152.86469.qmail@lists.php.net...
> Hello,
>
> 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?
>
> Thanks
> -Will

 

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

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