我想将此查询的总和显示为一个单元格,但这里的结果显示为一列,如总和
500
1000
但我想显示这些记录的总和(1500)
这是我的查询:
select sum(MAL_TASWYAHESAB.MADINMONY) as'Total Sum' from MAL_TASWYAHESAB
union
select sum(MAL_AMRSARF_OHAD.MONY) as'Total Sum' from MAL_AMRSARF_OHAD
我想将此查询的总和显示为一个单元格,但这里的结果显示为一列,如总和
500
1000
但我想显示这些记录的总和(1500)
这是我的查询:
select sum(MAL_TASWYAHESAB.MADINMONY) as'Total Sum' from MAL_TASWYAHESAB
union
select sum(MAL_AMRSARF_OHAD.MONY) as'Total Sum' from MAL_AMRSARF_OHAD
试试这个方法:
select (select sum(MAL_TASWYAHESAB.MADINMONY) from MAL_TASWYAHESAB)
+
(select sum(MAL_AMRSARF_OHAD.MONY) from MAL_AMRSARF_OHAD) as 'Total Sum'
SELECT SUM(MADINMONY) as'Total Sum'
FROM (
SELECT MAL_TASWYAHESAB.MADINMONY
FROM MAL_TASWYAHESAB
UNION MAL_AMRSARF_OHAD.MONY
FROM MAL_AMRSARF_OHAD
) AS a;
SELECT SUM(TotalSum) AS Total
FROM
(
select MAL_TASWYAHESAB.MADINMONY as 'TotalSum' from MAL_TASWYAHESAB
union
select MAL_AMRSARF_OHAD.MONY from MAL_AMRSARF_OHAD
) AS t
select sum(MADINMONY) as'Total Sum'
from (
select MAL_TASWYAHESAB.MADINMONY
from MAL_TASWYAHESAB
union MAL_AMRSARF_OHAD.MONY
from MAL_AMRSARF_OHAD
) AS X