Forum Moderators: open

Message Too Old, No Replies

Find everything but A-Z

         

switchjohnny

7:53 pm on Nov 6, 2007 (gmt 0)

10+ Year Member



I have my queries broken up so users can search by A, B, C, D etc

However, what do I do with fields that start with number and strange characters?

Some of my field entries have " + ' 0-9 and other characters. How can I search for those entries?

Select from Table where field like (+_-09 bla bla bla);

Oh yea, and I don't want to seperate them. I have it so you can click A B C D E F G ... Other

Other being everything else.

Can I do a select statement that finds everything but A-Z?

switchjohnny

8:20 pm on Nov 7, 2007 (gmt 0)

10+ Year Member



I answered this one myself.

Make my database better

Adding a new field for each letter a,b,c etc and 0 for everything else makes this alot easier.

LifeinAsia

10:23 pm on Nov 7, 2007 (gmt 0)

WebmasterWorld Administrator 10+ Year Member Top Contributors Of The Month



Until then, try this (it will depend on your DB's implementation of regular expressions):
SELECT *
FROM Table
WHERE Field NOT LIKE '[A-Z]%'

switchjohnny

1:25 am on Nov 9, 2007 (gmt 0)

10+ Year Member



I was hoping it was that easy. I ended up adding an extra field to my db to determine the starting letter of each value.

I'm still new to mysql, so there are plenty of obvious things I don't know yet, but I'm holding my own..

Thanks again.