如何於執行 SQL/400 查詢指令結果中加入最後一行 Total line 的功能?
1. STRSQL
2.
Select 'Item' As RowType,
PartId,
Price
From Part
Union
Select 'Total' As RowType,
0 As PartId,
Sum( Price ) As Price
From Part
Order By RowType,
PartId
3. PartID 是數字性欄位,若您的欄位是文字性,UNION 後之
0 As PartId
請改成
'0' As PartId
A blog about IBM i (AS/400), MQ and other things developers or Admins need to know.
星期二, 10月 31, 2023
2001-06-18 如何於執行 SQL/400 查詢指令結果中加入最後一行 Total line 的功能?
訂閱:
張貼留言 (Atom)
沒有留言:
張貼留言