日期:2014-05-20 浏览次数:20449 次
SELECT pname FROM products WHERE pname like (@key + '%') union all SELECT typename FROM products WHERE typename like (@key + '%') union all SELECT stylename FROM products WHERE stylename like (@key + '%')
------解决方案--------------------
把SQL语句改一下,另外后台在查询字段前也加个%
SELECT pname FROM products WHERE pname like ('%'+@key + '%') union all SELECT typename FROM products where typename like ('%'+@key + '%') union all SELECT stylename FROM products where stylename like ('%'+@key + '%')
------解决方案--------------------
select * from( SELECT pname as name,clickcount FROM products WHERE pname like (@key + '%') union SELECT typename,clickcount FROM products WHERE typename like (@key + '%') union SELECT stylename,clickcount FROM products WHERE stylename like (@key + '%') ) t order by name,clickcount