本帖最后由 lscxp 于 2011-03-18 15:47:11 编辑

解决方案 »

  1.   

    SELECT * FROM TT WHERE INSTR(`text`,CONCAT('aaaa','='))>0
      

  2.   

    select * 
    from 比如有一个表
    where `text` regexp '(^|&)2=';
      

  3.   

    mysql> select * from t_lscxp;
    +------+-------------+
    | id   | text        |
    +------+-------------+
    |    1 | 1=1         |
    |    2 | 2=10&10=3   |
    |    3 | 5=5&3=6     |
    |    4 | aaa=123     |
    |    5 | bbb=23      |
    |    6 | 2=7&3=100   |
    |    7 | 22=7&3=100  |
    |    8 | 22=7&2=100  |
    |    9 | 22=7&22=100 |
    +------+-------------+
    9 rows in set (0.02 sec)mysql> select *
        -> from t_lscxp
        -> where `text` regexp '(^|&)2=';
    +------+------------+
    | id   | text       |
    +------+------------+
    |    2 | 2=10&10=3  |
    |    6 | 2=7&3=100  |
    |    8 | 22=7&2=100 |
    +------+------------+
    3 rows in set (0.00 sec)mysql> select *
        -> from t_lscxp
        -> where `text` regexp '(^|&)3=';
    +------+------------+
    | id   | text       |
    +------+------------+
    |    3 | 5=5&3=6    |
    |    6 | 2=7&3=100  |
    |    7 | 22=7&3=100 |
    +------+------------+
    3 rows in set (0.00 sec)mysql> select *
        -> from t_lscxp
        -> where `text` regexp '(^|&)aaa=';
    +------+---------+
    | id   | text    |
    +------+---------+
    |    4 | aaa=123 |
    +------+---------+
    1 row in set (0.00 sec)mysql>