日期:2014-05-19  浏览次数:20450 次

求一条SQL查询语句,超级简单哈,要分的来
select   top   5   num   from   Product   Where   Name   LIKE   '% "   +   str_search   +   "% '   order   by   num   DESC

我现在想查询   Name   或者   ProducingArea   或者   Tag   都   LIKE   '% "   +   str_search   +   "% '     用SQL怎么写?

select   top   5   num   from   Product   Where   (Name   or   roducingArea   or   Tag)   LIKE   '% "   +   str_search   +   "% '   order   by   num   DESC   这样不对

select   top   5   num   from   Product   Where   Name   LIKE   '% "   +   str_search   +   "% '   or   producingArea     LIKE   '% "   +   str_search   +   "% '   order   by   num   DESC   这样又太麻烦


------解决方案--------------------
只能按麻烦的写
------解决方案--------------------
你想怎样?
------解决方案--------------------
select top 5 num from Product Where Name LIKE '% " + str_search + "% ' or producingArea LIKE '% " + str_search + "% ' order by num DESC

只能这样写吧!