Author Topic: arranging mysql data  (Read 155 times)

0 Members and 1 Guest are viewing this topic.

Offline sukanya.paulTopic starter

  • Irregular
    • View Profile
arranging mysql data
« on: July 01, 2009, 04:13:46 AM »
hi i have a table which has a field called month whose values are
January,February,March etc in no particular order

i am selecting all daya from this table and the month values are in the following order:
January
November
December
February
March
April
May
June
July
August
September
October

i want it to be displayed in the proper order
January
February
March
..
..
..
December

Can some1 please help me with this.
Thanks in advance
Suk

Offline Ken2k7

  • Fanatic
    • View Profile
Re: arranging mysql data
« Reply #1 on: July 01, 2009, 04:35:49 AM »
I would say to add a new column for the number representation of the month and use SQL ORDER BY to order them.
Quote from: Slaytanist
A programmer who shys away from elegant tricks will never be more than competent at best. Ego and a desire to attempt the impossible are traits of most great coders.


Offline fenway

  • MySQL Si-Fu / PHP Resident Alien
  • Global Moderator
  • 'Insane!'
  • *
  • Gender: Male
    • View Profile
Re: arranging mysql data
« Reply #2 on: July 01, 2009, 09:11:37 PM »
Wait, why are you storing month names?
:anim_rules: Seriously... if people don't start reading this before posting, I'm going to consider not answering at all.

PHP Freaks Forums

« on: »

Tired of these ads? Purchase a supporter subscription to get rid of them.