0

Hi to all keen folks,

can you help me to query the first 4 letters and the last 4 letters in one field.

example: AAAABBBBCCCCDDDD how to query AAAA and DDDD.

thank you.

2
Contributors
3
Replies
4
Views
8 Years
Discussion Span
Last Post by phpbeginners
0

Quickest option, although it isn't restricted to only four characters would be to:

select * from `example` where `content` like 'AAAA%' or `content` like '%DDDD';

For a more precise solution, I would look to use MySQL regular expressions.

Hope this helps,
R.

0

in regexp like this

select myletters from testing_letters where myletters regexp '^AAAA' and myletter regexp 'DDDD$'

thank you

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.