mysql中 order by 繁体中文不能实现排序!
网上的几种方法都不行:方法1、 一种解决方法是对于包含中文的字段加上"binary"属性,使之作为二进制比较;方法2、select * from student order by binary name desc;
上面两种方法都不行,哪位大侠帮助解决,100分相送!

解决方案 »

  1.   

    问一个问题,我的CSDN答不开,所以在这里提,分数我在另外加
    表1
    ALLNAME(字段名)
    湖北大田公司
    中国房产公司 表2
    NAME(字段名)
    房产
    现需要找出在表2中有简称的企业名称,也即中国房产公司 我写的
    select table1.allname,table2.[name]
    from table1,table2 
    where table1.allname like '%'+table2.[name]+'%' 
    怎么不行呀,用子查询也不行呀?
    谢谢急用,50分另外给!!!!!!!!
      

  2.   

    下面有一个例子,不知道对你有没有帮助,你自己看一下好了.
    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)