Reply to Selecting the distinct first alpha numeric characters from a column

Your name:

Reply:


Posted by Peter Albertsson on 06/28/05 01:07

Hi,

I've a MySQL (MySQL 5.0.7-beta) database with movie information. One table
contains the movie titles. I want to select the distinct first alpha numeric
characters from all the movie titles. The problem is that some movie titles
look like this: '...And Justice for All', that is, the first letter is not
an alpha numeric letter.

My query now looks like this:

SELECT DISTINCT SUBSTRING(title, 1, 1) AS letter FROM movie_titles ORDER BY
letter

That means that '...And Justice for All' will be sorted under '.', but I
want that movie title to be sorted under 'A' in my application.

So I thought maybe I could use reg exps, but MySQL reg exp function only
returns 0 or 1, never the match.

Does anyone have any idea how I could query for the first alpha numeric
(0-9a-zA-z) character in a string?

Thanks in advance,

Peter Albertsson

[Back to original 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

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация