用动易的系统,想统计每天上传资料的排行,用的查询语句如下:
select Top {input(2)} count(PE_Soft.Inputer) as num,Inputer from PE_Soft where ChannelID in ({input(0)}) and ClassID in ({input(1)}) and DateDiff("d",getdate(), UpdateTime)=0 Group By num Order By num Desc因为想用的是动易的函数标签,这里{input(2)}表示在标签参数里设置显示的记录条数,{input(0)}表示类型属于软件频道的那些频道ID,如果为0,表示取所有软件频道,{input(1)}表示要统计的那些软件频道的指定的栏目ID,如果这里为0表示取所有频道,数据表字段如下:
SoftID 软件ID
SoftName 软件名称
UpdateTime 更新时间
Inputer 上传者循环语句如下:
{Loop}{Infobegin}<img src="{$InstallDir}images/Soft_common.gif">{$Field(1,text,0,0)} ({$Field(0,Num,0,0)}个)<br>{Infoend}){/Loop}
不懂动易的朋友这里也不需要了解这个循环语句.我想显示的效果如下:
张三(12个)李四(10个)王五(8个)现在就是这个查询语句总提示出错:
SQL查询失败,错误原因:列 'pe_soft.Inputer' 在选择列表中无效,因为该列未包含在聚合函数中,并且没有 GROUP BY 子句。
我改如何修改这个查询语句来实现我要的功能呢?
select Top {input(2)} count(PE_Soft.Inputer) as num,Inputer from PE_Soft where ChannelID in ({input(0)}) and ClassID in ({input(1)}) and DateDiff("d",getdate(), UpdateTime)=0 Group By num Order By num Desc因为想用的是动易的函数标签,这里{input(2)}表示在标签参数里设置显示的记录条数,{input(0)}表示类型属于软件频道的那些频道ID,如果为0,表示取所有软件频道,{input(1)}表示要统计的那些软件频道的指定的栏目ID,如果这里为0表示取所有频道,数据表字段如下:
SoftID 软件ID
SoftName 软件名称
UpdateTime 更新时间
Inputer 上传者循环语句如下:
{Loop}{Infobegin}<img src="{$InstallDir}images/Soft_common.gif">{$Field(1,text,0,0)} ({$Field(0,Num,0,0)}个)<br>{Infoend}){/Loop}
不懂动易的朋友这里也不需要了解这个循环语句.我想显示的效果如下:
张三(12个)李四(10个)王五(8个)现在就是这个查询语句总提示出错:
SQL查询失败,错误原因:列 'pe_soft.Inputer' 在选择列表中无效,因为该列未包含在聚合函数中,并且没有 GROUP BY 子句。
我改如何修改这个查询语句来实现我要的功能呢?
from PE_Soft
where ChannelID in ({input(0)}) and ClassID in ({input(1)}) and DateDiff("d",getdate(), UpdateTime)=0
Group By Inputer,num --这里追加Inputer
Order By num Desc
SQL codeselect Top {input(2)} count(PE_Soft.Inputer) as num,Inputer
from PE_Soft
where ChannelID in ({input(0)}) and ClassID in ({input(1)}) and DateDiff("d",getdate(), UpdateTime)=0
Group By Inputer,num --这里追加Inputer
Order By num Desc
顶大哥的。 。