View Full Version : List mysql results by#, or Letter starts with?
puffyz
Jul 9th 2008, 11:52 am
Hey everyone, anyone know how, have a script handy or know of one out there that can list mysql results by # or Letter they start with?...IE:
#
List all mysql results in table that start with a #
A
List all mysql results in table that start with a A
B
List all mysql results in table that start with a B
.....
Z
List all mysql results in table that start with a Z
thanks in advance!
B
kmap
Jul 9th 2008, 11:55 am
yes i have pm me to buy it
Regards
Alex
Danltn
Jul 9th 2008, 12:07 pm
LIKE...
a%
b%
etc, you get the idea.
Mozzart
Jul 9th 2008, 12:56 pm
Well... lets see if I grasped his post..
You want to get the posts from number a to numbers what?
If so then regex might just do the job for you
SELECT * FROM whatever WHERE column REGEXP '^[aA]'
That will list from a to A only, check for more regex metacharacters and other things to complete your queries :) shouldn't be too hard to figure out at this level
At the start of the line it will only output
america
Asia
alvin
you get the idea, it's a range.
Another example:
SELECT * FROM `configuration` WHERE `configuration_title` REGEXP '^[sSEe]' (from a zencart database i use, if you have one, try it)
It will query from s to S and e to E at the start of each line
vBulletin® v3.8.4, Copyright ©2000-2009, Jelsoft Enterprises Ltd.