mytable
-------
addressColoumn
1 street
2 street
my address
your address
select address from mytable where addressColoumn= (first 3 character as alpha(character))
so it should return two records
my address
your address
what will be the query?
From your example I'm guessing you mean A-Z, in caps or lowercase, and/or space.
For SQL Server:
where addressColoumn like '[a-z ][a-z ][a-z ]%'
For MySQL:
where addressColoumn REGEXP '^[a-zA-Z ][a-zA-Z ][a-zA-Z ]'
For Oracle:
where regexp_like (addressColoumn, '^[a-zA-Z ][a-zA-Z ][a-zA-Z ]')
Of course, you can also reverse the condition, and check for a numeric first character. Should be easy to adopt the above snippets for that.
精彩评论