Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

MySQL Select non alphabetic records

Status
Not open for further replies.

MrBelfry

IS-IT--Management
May 21, 2003
289
Hey there kids

Is there any way to write a sql statement that extracts all records from a databse that DON'T begin with a letter ie a number or some other character?

Please help me. I'm stupid

Thanks

MrBelfry
 
which records do you want to see when it may not begin with a character ???
 
I have a site that has some album reviews. If a band's name begins with a number then I group them all together. So if I have a band called '216 State' or '1,000 Foot Krutch' or something I would like to group them together on a page where I can see their titles and stuff.

See the site at for what I'm trying to achieve.

MrBelfry
 
so you group by the first character and make a link that queries with that first character

select distinct(substr(name,0,1)) as shortname from tablename

the result for each you can pass to an url which loads a page that search on that key

search.php?shortname=$shortname

in search.php you have something like

select name from tablename where name like '$shortname%'


if you are not yet familiar in how to write the code than I can help you out later on.
 
Here's how I solved it

SELECT * FROM tablename WHERE fieldname NOT BETWEEN 'a' AND 'z'

MrBelfry
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top