mysql中 order by 繁体中文不能实现排序!
网上的几种方法都不行:方法1、 一种解决方法是对于包含中文的字段加上"binary"属性,使之作为二进制比较;方法2、select * from student order by binary name desc;
上面两种方法都不行,哪位大侠帮助解决,100分相送!
网上的几种方法都不行:方法1、 一种解决方法是对于包含中文的字段加上"binary"属性,使之作为二进制比较;方法2、select * from student order by binary name desc;
上面两种方法都不行,哪位大侠帮助解决,100分相送!
解决方案 »
- 如何把windows sqlserver数据库转到我的linux mysql数据库中
- 求教:MySQL cluster API的使用
- 触发器插入其它表中无法插入NULL空值报错。
- 如何解决mysql数据库回滚插入默认行
- 我查询出一个数字!如何取整数
- 拼成一个UNION语句
- 如何两台机做mysql群集----现实应用,不是实验
- !!!100分求解数据库复制问题~~立刻结帖
- mysql使用问题!!(在线急切等待ing,给达人送100分)
- 函数查询报错:[Err] 1406 - Data too long for column 'rootId' at row 1
- mysql的blob字段存储中文,输出乱码
- jsp连接mysql数据库
表1
ALLNAME(字段名)
湖北大田公司
中国房产公司 表2
NAME(字段名)
房产
现需要找出在表2中有简称的企业名称,也即中国房产公司 我写的
select table1.allname,table2.[name]
from table1,table2
where table1.allname like '%'+table2.[name]+'%'
怎么不行呀,用子查询也不行呀?
谢谢急用,50分另外给!!!!!!!!
mysql> desc a;
+---------+-------------+------+-----+---------+----------------+
| Field | Type | Null | Key | Default | Extra |
+---------+-------------+------+-----+---------+----------------+
| id | int(11) | NO | PRI | NULL | auto_increment |
| allname | varchar(24) | NO | | | |
+---------+-------------+------+-----+---------+----------------+
2 rows in set (0.03 sec)mysql> insert into a(allname) values('湖北大田公司'),('中国房产公司');
Query OK, 2 rows affected (0.13 sec)
Records: 2 Duplicates: 0 Warnings: 0mysql> select * from a;
+----+--------------+
| id | allname |
+----+--------------+
| 1 | 湖北大田公司 |
| 2 | 中国房产公司 |
+----+--------------+
2 rows in set (0.00 sec)mysql> desc b;
+-------+-------------+------+-----+---------+----------------+
| Field | Type | Null | Key | Default | Extra |
+-------+-------------+------+-----+---------+----------------+
| id | int(11) | NO | PRI | NULL | auto_increment |
| name | varchar(24) | NO | | | |
+-------+-------------+------+-----+---------+----------------+
2 rows in set (0.08 sec)
mysql> insert into b(name) values('房产');
Query OK, 1 row affected (0.00 sec)mysql> select * from b;
+----+------+
| id | name |
+----+------+
| 1 | 房产 |
+----+------+
1 row in set (0.00 sec)mysql> select a.allname,b.name from a,b where a.allname like concat('%',b.name,'
%');
+--------------+------+
| allname | name |
+--------------+------+
| 中国房产公司 | 房产 |
+--------------+------+
1 row in set (0.11 sec)