我现在在MYSQL 里面要写一个查询语句  查询 customer表里面的 name 属性中包含  %(百分号)  的查询语句   有哪位高手告诉下怎么写 谢谢  急用!!!

解决方案 »

  1.   

    例如:select * from customer where name like '王%';
      

  2.   


    select * from customer where name like '\%'
    或者
    select * from customer where name like '|%' ESCAPE '|'
    ESCAPE '|'中的|任意
      

  3.   

    like '\%'以下摘自 MySQL 5.1 Reference Manual
    The “\%” and “\_” sequences are used to search for literal instances of “%” and “_” in pattern-matching contexts where they would otherwise be interpreted as wildcard characters. See the description of the LIKE operator in Section 11.4.1, “String Comparison Functions”. If you use “\%” or “\_” in non-pattern-matching contexts, they evaluate to the strings “\%” and “\_”, not to “%” and “_”. .
        [align=center]====  ====
    [/align]
    .
    贴子分数<20:对自已的问题不予重视。
    贴子大量未结:对别人的回答不予尊重。
    .
      

  4.   

    推荐你看一下这些帮助
    SQL 1992
    MySQL 5.1 Reference Manual
    ActiveX Data Objects 2.5 Reference 下载
    数据库系统概论PPT.
        [align=center]====  ====
    [/align]
    .
    贴子分数<20:对自已的问题不予重视。
    贴子大量未结:对别人的回答不予尊重。
    .
      

  5.   

    select * from aa1 where 姓名 like '%\%'
      

  6.   

    select * from aa1 where 姓名 REGEXP '%'
      

  7.   

    SELECT * FROM customera where name like '%\%%'
    检索出name 中含有'%'的所有字段