62,074
社区成员
发帖
与我相关
我的任务
分享
谢谢认真的看完
select top(" + paramTopNote + ") id,BatchID,GenTime,Mobile, prov, city, case when MsgContent is null then (select MsgContent from MsgBatchID where MsgBatchID.BatchID = MsgTasks.BatchID) else MsgContent end as MsgContent,Prior,MobileRange,MobileRange2,UserID,"
+ " case when IsSending=1 then '是' else '否' end as IsSending, case when convert(varchar(50),SendServerID)='-1' then '无' else convert(varchar(50),SendServerID) end as SendServerID,SendOK,IsTest "
+ " from MsgTasks where sendok <> 1 "
+ " and id not in("
+ " select top(" + paramNotTopNote + ") id "
+ " from View_MsgTasks where sendok <> 1 and ( " + strSqlAndUserID + " " + strSqlAnd + " " + paramTextContent + ") order by id desc ) and ( " + strSqlAndUserID + " " + strSqlAnd + "" + paramTextContent + ") order by id desc";
这可以得到一个新表显示id,BatchID,GenTime,Mobile, prov, city, MsgContent 。。。。。。
我想把里面的MsgContent这个字段的内容取出来进行 内容模糊查询 string sqlLike="MsgContent Like'%"+变量+"%'";
这个应该加在哪里啊 内容只显示 跟内容相似的内容....谢谢
"select top(" + paramTopNote + ") id,BatchID,GenTime,Mobile, prov, city, case when MsgContent is null then (select MsgContent from MsgBatchID where MsgBatchID.BatchID = MsgTasks.BatchID) else MsgContent end as MsgContent,Prior,MobileRange,MobileRange2,UserID,"
+ " case when IsSending=1 then '是' else '否' end as IsSending, case when convert(varchar(50),SendServerID)='-1' then '无' else convert(varchar(50),SendServerID) end as SendServerID,SendOK,IsTest "
+ " from MsgTasks where sendok <> 1 and MsgContent Like'%"+变量+"%'"
+ " and id not in("
+ " select top(" + paramNotTopNote + ") id "
+ " from View_MsgTasks where sendok <> 1 and ( " + strSqlAndUserID + " " + strSqlAnd + " " + paramTextContent + ") order by id desc ) and ( " + strSqlAndUserID + " " + strSqlAnd + "" + paramTextContent + ") order by id desc";
seect id,BatchID,GenTime,Mobile, prov, city,MsgContent,Prior,MobileRange,MobileRange2,UserID,IsSending,SendServerID,SendOK,IsTest
from (
-- 这里写你的上面贴的查询语句
)
where MsgContent like '%' + 变量 + '%'