当前位置: 代码迷 >> ASP.NET >> 求一条SQL查询话语,超级简单哈,要分的来
  详细解决方案

求一条SQL查询话语,超级简单哈,要分的来

热度:9723   发布时间:2013-02-26 00:00:00.0
求一条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

只能这样写吧!
  相关解决方案