发新话题
打印

管理员帮看下怎么弄

管理员帮看下怎么弄

现在我要将select type_,count(*) as cnt from itom_device group by type_做张报表,现在是显示两个字段的报表一个是类型以个是数量。而其中的type和另一张表关联,我之前是给type加个数据集。可是只循环显示第一条。。。请帮忙看下如何决绝。。。非常感谢。

[ 本帖最后由 lmf2010 于 2010-6-29 09:50 编辑 ]
附件: 您所在的用户组无法下载或查看附件

TOP

这个你得学学 sql了.比如,你有一个表格t_type,用于每个type的相关信息,如
type  typename ...
20    类型a
DeviceType-1 类型b

select type_typename,count(*) as cnt from t_type,x where x.type = t_type.type group by type_typename

注:本sql没经过调试,只为说明解法.

TOP

资产百分率类统计,统计处于某种状态的资产(如在用资产)占全部资产的比率;
select a.data_name,a.status_,a.cnt, round(a.cnt/b.cnt*100,2) from
(select data_name,status_,count(*) as cnt from itom_device,base_datadict where dict_id=type_  group by data_name,status_) a,
(select data_name,count(*) as cnt from itom_device,base_datadict where dict_id=type_  group by data_name) b
where a.data_name=b.data_name


请问这个怎么设计,round(a.cnt/b.cnt*100,2) 这个列在报表中显示不出来,通过简表中的什么可以实现,讲下谢谢。
附件: 您所在的用户组无法下载或查看附件

TOP

已解决,非常感谢管理员的帮助

TOP

发新话题