请教统计表方法。
表有name(名称),class(级别),qty(数量),数据如下:
nameclassqty
红橡a12
红橡aaNULL
红橡aaa13
梨木a10
梨木aa10
梨木aaaNULL
我想在GIRD表中,得到如下的结果:
nameclassqty
红橡a12
aaNULL
aaa13
小计25
梨木a10
aa10
aaaNULL
小计20
名称相同的只显示第一个,并且按名称相同的做个小计。
请教了!
[解决办法]
release 9;datawindow(units=0 timer_interval=0 color=1073741824 processing=1 HTMLDW=no print.printername="" print.documentname="" print.orientation = 0 print.margin.left = 110 print.margin.right = 110 print.margin.top = 96 print.margin.bottom = 96 print.paper.source = 0 print.paper.size = 0 print.canusedefaultprinter=yes print.prompt=no print.buttons=no print.preview.buttons=no print.cliptext=no print.overrideprintjob=no print.collate=yes hidegrayline=no grid.lines=0 )header(height=72 color="536870912" )summary(height=0 color="536870912" )footer(height=0 color="536870912" )detail(height=84 color="536870912" )table(column=(type=char(10) updatewhereclause=yes name=name dbname="name" ) column=(type=char(10) updatewhereclause=yes name=class dbname="class" ) column=(type=number updatewhereclause=yes name=qty dbname="qty" ) )data("红橡","a", 12,"红橡","aa",null "红橡","aaa", 13,"梨木","a", 10,"梨木","aa", 10,"梨木","aaa",null ) group(level=1 header.height=0 trailer.height=76 by=("name" ) header.color="536870912" trailer.color="536870912" )text(band=header alignment="2" text="Name" border="0" color="33554432" x="9" y="8" height="56" width="274" html.valueishtml="0" name=name_t visible="1" font.face="宋体" font.height="-9" font.weight="400" font.family="0" font.pitch="2" font.charset="134" background.mode="1" background.color="536870912" )text(band=header alignment="2" text="Class" border="0" color="33554432" x="293" y="8" height="56" width="279" html.valueishtml="0" name=class_t visible="1" font.face="宋体" font.height="-9" font.weight="400" font.family="0" font.pitch="2" font.charset="134" background.mode="1" background.color="536870912" )text(band=header alignment="2" text="Qty" border="0" color="33554432" x="581" y="8" height="56" width="219" html.valueishtml="0" name=qty_t visible="1" font.face="宋体" font.height="-9" font.weight="400" font.family="0" font.pitch="2" font.charset="134" background.mode="1" background.color="536870912" )column(band=detail id=1 alignment="0" tabsequence=10 border="0" color="33554432" x="9" y="8" height="68" width="274" format="[general]" html.valueishtml="0" name=name visible="1" edit.limit=0 edit.case=any edit.focusrectangle=no edit.autoselect=yes edit.autohscroll=yes edit.imemode=0 font.face="宋体" font.height="-9" font.weight="400" font.family="0" font.pitch="2" font.charset="134" background.mode="1" background.color="536870912" )column(band=detail id=2 alignment="0" tabsequence=20 border="0" color="33554432" x="293" y="8" height="68" width="279" format="[general]" html.valueishtml="0" name=class visible="1" edit.limit=0 edit.case=any edit.focusrectangle=no edit.autoselect=yes edit.autohscroll=yes edit.imemode=0 font.face="宋体" font.height="-9" font.weight="400" font.family="0" font.pitch="2" font.charset="134" background.mode="1" background.color="536870912" )column(band=detail id=3 alignment="1" tabsequence=30 border="0" color="33554432" x="581" y="8" height="68" width="219" format="[general]" html.valueishtml="0" name=qty visible="1" edit.limit=0 edit.case=any edit.focusrectangle=no edit.autoselect=yes edit.autohscroll=yes edit.imemode=0 font.face="宋体" font.height="-9" font.weight="400" font.family="0" font.pitch="2" font.charset="134" background.mode="1" background.color="536870912" )compute(band=trailer.1 alignment="1" expression="sum(if(isnull(qty), 0, qty) for group 1)"border="0" color="33554432" x="581" y="8" height="68" width="219" format="[GENERAL]" html.valueishtml="0" name=compute_1 visible="1" font.face="宋体" font.height="-9" font.weight="700" font.family="0" font.pitch="2" font.charset="134" background.mode="2" background.color="1073741824" )text(band=trailer.1 alignment="0" text="小计" border="0" color="33554432" x="9" y="12" height="56" width="279" html.valueishtml="0" name=t_1 visible="1" font.face="宋体" font.height="-9" font.weight="700" font.family="0" font.pitch="2" font.charset="134" background.mode="2" background.color="1073741824" )sparse(names="name")htmltable(border="1" )htmlgen(clientevents="1" clientvalidation="1" clientcomputedfields="1" clientformatting="0" clientscriptable="0" generatejavascript="1" encodeselflinkargs="1" netscapelayers="0" )export.xml(headgroups="1" includewhitespace="0" metadatatype=0 savemetadata=0 )import.xml()export.pdf(method=0 distill.custompostscript="0" xslfop.print="0" )