mysql 参数为空是不查询 参数非空时查询,这个查询语句怎么写?
select * from a where a.b=b and a.c=c 
现在只要有参数为null就查询不出来。

解决方案 »

  1.   

    select * from a where a.b is null and a.c is null;
      

  2.   

    if b='' then
    select * from tb;
    else
    select * from a where a.b=b;
    end if;
      

  3.   

    查询where的参数可能为空,当为空的时候省略空的参数.查出符合不是空参数的记录.
      

  4.   

    select * from a where a.b is not null and a.c is not null;
      

  5.   

    你的完整代码是什么? 
    select * from a where a.b=b and a.c=c 这个语句的参数是怎么来的?通过你的ASP程序生成的查询SQL语句还是存储过程中?问题说明越详细,回答也会越准确!参见如何提问。(提问的智慧
      

  6.   

    语句是这样的.
    select new goods(g.goodsid,g.wprice,g.spicpath,g.brand,g.sort,g.style) from goods g where g.brand.brandid = :brandid and g.style.styleid = :styleidis not null 出错的.