1

如果在 sybase - infomaker 文件中 - 我没有任何组,但由于我使用它在我的软件中构建页面,我需要能够对值求和。请参阅随附的屏幕截图。总计. 我希望总数是唯一的(或按 id_key 值分组)。

求和功能具有以下能力。正如我在这里找到的:http: //infocenter.sybase.com/help/index.jsp?topic=/com.sybase.dc00045_0250/html/ddref/ BFCDFAJD.htm

Sum ( column { FOR range { DISTINCT { expres1 {, expres2  {, ... } } } } } )

我拥有的代码是:sum(adult + Senior_student + child + other for page) 但我想做的是“用于 id_key”,但它似乎不喜欢那样

4

1 回答 1

1

如果您的列名称对应于答案上方的标题,则应该是:(您也需要考虑 Null 字段)。

sum(((If(IsNull(adult), 0, adult))    +
(If(IsNull(senior_student), 0, senior_student))  +
(If(IsNull(child), 0,child)) +
(If(IsNull(other), 0,other)))                
for page distinct id_key)

按对象求和:

 (If(IsNull(adult), 0, adult)) + 
 (If(IsNull(senior_student), 0, senior_student)) + 
 (If(IsNull(child), 0,child)) + 
 (If(IsNull(other), 0,other))
于 2015-01-21T19:33:59.257 回答