Using SUM() without grouping the results

后端 未结 4 1861
别那么骄傲
别那么骄傲 2020-12-03 10:34

I already read (this), but couldn\'t figure out a way to implement it to my specific problem. I know SUM() is an aggregate function and it doesn\'t make sense n

4条回答
  •  难免孤独
    2020-12-03 11:05

    Join the original table to the sum with a subquery:

    SELECT * FROM table1, (SELECT SUM(amount) FROM table1 AS amount) t
    

提交回复
热议问题