首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 网站开发 > asp.net >

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

2011-12-15 
求一条SQL查询语句,超级简单哈,要分的来selecttop5numfromProductWhereNameLIKE% +str_search+%orderbyn

求一条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

只能这样写吧!

热点排行