我正在尝试进行一个看起来像这样的查询..
|tipe of operation | UMT | Total |
__________________________________
|reach | 1.5 | 1.5 |
|reach | 1.5 | 3 |
|reach | 1.5 | 4.5 |
|take | 1 | 5.5 |
|take | 2 | 7.5 |
(根据列将总字段加在一起)*
我曾尝试过多种方式而无法实现..... 到目前为止,我最先进的查询是这个,它给了我以下结果...
|tipe of operation | UMT | Total |
__________________________________
|reach | 1.5 | 1.5 |
|reach | 1.5 | 1.5 |
|reach | 1.5 | 1.5 |
|take | 1 | 1 |
|take | 1 | 1 |
这是我的查询
select tablamtmtipo as 'tipe of operation'
, tablamtmdatos as 'UMT'
, sum(tablamtmdatos) as Total
from tablamtm
WHERE tablamtmoperacion = 'operación 1'
group by idtablamtm
我只有一个包含这些字段的表
1- idtablamtm
2- tablamtmoperacion
3- tablamtmtype
4- tablamtmdatos