PDA

View Full Version : MYSQL - Alpha Range


davidj
08-30-2006, 09:23 AM
Im Stuck

Anybody know the correct syntax for the following psudo code

SELECT * from table where field1 = '11' and field2= '3' and field3 between 'a%' and 'f%'
notice the field3 condition. Thats what im interested in.. An alpha range between 2 chars.

I dont want to use... LIKE 'a%' or LIKE 'B%' or LIKE 'C%' coz its rubbish..

there must be a better way

I have looked into REGEXP but it just returns a boolean which is useless when i want to return a count

davidj
08-30-2006, 09:53 AM
well DJ here's how you do it great mate

AND field REGEXP '^[H|I|J|K|L|M|N|O|P|Q|R|S|T|U|V|W|X|Y|Z]'

much better than loads of OR this OR this OR this.. Wouldnt you agree

davidj
08-30-2006, 09:54 AM
Thanks for that Top Bloke

thats saved me a load of time

davidj
08-30-2006, 09:55 AM
No problem handsome one

Any Time!!

domedia
08-30-2006, 01:12 PM
rofl

Creative Insanity
08-30-2006, 06:49 PM
Does anyone else smell a touch of vanity around here?? LOL

edbr
09-01-2006, 06:35 AM
I think is a hint of newcastle brown ale

davidj
09-01-2006, 08:47 AM
newcastle brown ale ...

I will be on the fall-y down water tonight for a major binge drinking session. Then off to the casino to win millions

LUCKY 16 ..... BRING IT ON !

domedia
09-01-2006, 04:05 PM
uhm.. that's my favorite beer.. weird..
Unless it's a poker game, then it's Boddingtons.