NamePros
Welcome, Guest! Ready to make a name for yourself in the domain business? We welcome both the hobbyist and professional domainer to join the discussion as part of the NamePros community.

Click here to create your profile to start earning reputation for posting, and trader ratings for buying & selling in our free e-marketplace. Build your trader rating with each successful sale. Our system has tracked over 100,000 sales and counting!
FAQ & TOS Register Search Today's Posts Mark Forums Read

Go Back   NamePros.com > Website Development Discussion Forums > Programming > CODE
Reload this Page [mysql] I need help with querying just the first letters.

CODE This forum is for posting code snippets and example scripts that aren't quite tutorials, but could be useful for others. You may post code snippets and/or completed scripts that you've written and want to share here.

Advanced Search
7 members in live chat ~  


Closed Thread
 
LinkBack Thread Tools
Old 12-17-2006, 11:27 PM THREAD STARTER               #1 (permalink)
NamePros Regular
 
bliss's Avatar
Join Date: Dec 2005
Posts: 950
bliss is a name known to allbliss is a name known to allbliss is a name known to allbliss is a name known to allbliss is a name known to allbliss is a name known to allbliss is a name known to allbliss is a name known to all
 



[mysql] I need help with querying just the first letters.


Anyone know how to do a query for a varchar field and only return query's that the first letter is up/lower case 'A' or up/lower case 'B' etc..

It is late and I have been coding all day long and my brain is fried. Please help or post examples I could look over. The % could be used, but I don't know how to use it.
bliss is offline  
Old 12-18-2006, 12:10 AM   #2 (permalink)
Senior Member
 
Barrucadu's Avatar
Join Date: Aug 2005
Location: East Yorkshire, England
Posts: 2,689
Barrucadu is a splendid one to beholdBarrucadu is a splendid one to beholdBarrucadu is a splendid one to beholdBarrucadu is a splendid one to beholdBarrucadu is a splendid one to beholdBarrucadu is a splendid one to beholdBarrucadu is a splendid one to behold
 




I think it would be:

Code:
SELECT * FROM `table` WHERE `field` REGEXP "^([a-zA-Z]+)([.*]+)"
Barrucadu is offline  
Old 12-18-2006, 01:16 AM THREAD STARTER               #3 (permalink)
NamePros Regular
 
bliss's Avatar
Join Date: Dec 2005
Posts: 950
bliss is a name known to allbliss is a name known to allbliss is a name known to allbliss is a name known to allbliss is a name known to allbliss is a name known to allbliss is a name known to allbliss is a name known to all
 



I found it..

thanks, i think you misunderstand, but thank you for trying.

Code:
SELECT * FROM `table` WHERE `field` LIKE 'a%'
bliss is offline  
Closed Thread


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools


 
All times are GMT -7. The time now is 03:15 PM.

Domain name forum recommended by Domaining.com Powered by: vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.6.0 Ad Management plugin by RedTyger