ORDER BY being ignored :(

I’ve got a very simple table:

CREATE TABLE `active_songs` (
  `id` int(11) NOT NULL auto_increment,
  `song_title` varchar(255) default NULL,
  `artist_name` varchar(255) default NULL,
  `label` varchar(255) default NULL,
  `hide_from_chart` varchar(255) default NULL,
  `created` datetime default NULL,
  `created_week` int(11) default NULL,
  `user_added` tinyint(4) default NULL,
  PRIMARY KEY  (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;

And when I run a simple SELECT on it with an ORDER BY directive it doesn’t order by the field I specify. It is only ordering by the ID field.

SELECT * FROM active_songs WHERE hide_from_chart != '1' ORDER BY 'song_title' ASC

The query above should output the song list and order them by song title (obviously) but it’s outputting them by ID no matter what. No errors are being thrown.

Thanks

It’s not that obvious… if you put song_title between quotes :wink:

Oh… nice… so - this started happening right after I migrated this script to a new server… those were originally “tildes” (the key under left hand esc). I wonder what would cause them to be transformed to single quotes / apostrophes.

thanks for the heads up.

i’m betting they were actually “backticks” (the key under left hand esc)

~ = tilde
` = backtick

and they “transformed to single quotes” when somebody typed them in wrong

:smiley:

Not necessarily. It once happened to me when I copy&pasted a query. I don’t remember where I pasted it (something like Notepad, or directly in a webbased file management editing window) but when I saved it and ran the script, the backticks had become simple quotes… :shifty:

i’ll bet it was microsoft word, lol

Could be :smiley: