科讯系统SQL自定义标签
我知道调用一个栏目的查询语句写为:selecttop{$Param(0)}id,title,replace(city,'市','')ascityfromKS_Articl...
我知道调用一个栏目的查询语句写为:
select top {$Param(0)} id,title,replace(city,'市','') as city from KS_Article where verific=1 and deltf=0 and tid = '{$Param(3)}' and id not in (select top {$Param(2)} id from KS_Article where verific=1 and deltf=0 and istop=1 and tid = '{$Param(3)}' order by adddate desc) order by adddate desc
调用多个栏目:
SQL就应该是:
select top 20 id,title,replace(city,'市','') as city from KS_Article
where verific=1 and deltf=0 and tid in ('20080625314169','20083944670051','20083673881973') and id not in (
select top 1 id from KS_Article where verific=1 and deltf=0 and istop=1
and tid in ('20080625314169','20083944670051','20083673881973') order by adddate desc) order by adddate desc
模板上传值为
{SQL_新闻首页列表(9,40,0,20080625314169|20083944670051|20083673881973)}
请问该怎么修改查询语句?
我也知道用 replace把“|”符号替换掉。但是就是怎么写也不对。求高手指点下,谢谢 展开
select top {$Param(0)} id,title,replace(city,'市','') as city from KS_Article where verific=1 and deltf=0 and tid = '{$Param(3)}' and id not in (select top {$Param(2)} id from KS_Article where verific=1 and deltf=0 and istop=1 and tid = '{$Param(3)}' order by adddate desc) order by adddate desc
调用多个栏目:
SQL就应该是:
select top 20 id,title,replace(city,'市','') as city from KS_Article
where verific=1 and deltf=0 and tid in ('20080625314169','20083944670051','20083673881973') and id not in (
select top 1 id from KS_Article where verific=1 and deltf=0 and istop=1
and tid in ('20080625314169','20083944670051','20083673881973') order by adddate desc) order by adddate desc
模板上传值为
{SQL_新闻首页列表(9,40,0,20080625314169|20083944670051|20083673881973)}
请问该怎么修改查询语句?
我也知道用 replace把“|”符号替换掉。但是就是怎么写也不对。求高手指点下,谢谢 展开
若以下回答无法解决问题,邀请你更新回答
展开全部
你这select好几个字段,怎么就给显示一个值…这怎么知道你哪个字段求得的那一串数字…你把全部的都写出来……
追问
说白了就是改造
and tid = '{$Param(3)}' 现在是一个ID,改为多个ID的写法
and tid in ( '{$Param(3)}') ,{$Param(3)} 接到的是 20080625314169|20083944670051|20083673881973
怎么改为 in ('','','') 明白吗?
追答
你可以分开( tid in()or tid in() or tid in() )
如果使用replace分开的话可以试试tid in ( replace( (’{$Param(3)}‘) , "|" , "’,‘" ) ),其中{$Param(3)}
=20080625314169|20083944670051|20083673881973
注意括号和符号
本回答被提问者采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询