select * from mi_resource where CONV(HEX(left(CONVERT(title USING gbk),1)),16,10) between 45253 and 45760 or title like 'b%' or title like 'B%';
英文26个字母中除了i,u,v三个字母不能成为汉语拼音的首字母外,其它的字母都可以。如果我们需要查询结果集中以A或者其它字母开头的汉语,实现方法如下,譬如,查询t_pvipuserinfo表中以字母B或者b开头的username 和以拼音中b(bo)开头的汉字姓名:
select * from t_pvipuserinfo where CONV(HEX(left(CONVERT(usernameUSING gbk),1)),16,10) between 45253 and 45760 or username like 'b%' or usernamelike 'B%'
其中45253与45760分别为汉语拼音首字母以B开头的拼音编码的开始值与结束值。
希望能为您带来方便,其它的值为:
字母 | 起值 | 止值 |
A | 45217 | 45252 |
B | 45253 | 45760 |
C | 45761 | 46317 |
D | 46318 | 46825 |
E | 46826 | 47009 |
F | 47010 | 47296 |
G | 47297 | 47613 |
H | 47614 | 48118 |
J | 48119 | 49061 |
K | 49062 | 49323 |
L | 49324 | 49895 |
M | 49896 | 50370 |
N | 50371 | 50613 |
O | 50614 | 50621 |
P | 50622 | 50905 |
Q | 50906 | 51386 |
R | 51387 | 51445 |
S | 51446 | 52217 |
T | 52218 | 52697 |
W | 52698 | 52979 |
X | 52980 | 53688 |
Y | 53689 | 54480 |
Z | 54481 | 55289 |