Sum of multiplication of columns for rows with similar IDs in MySQL

前端 未结 2 978
别那么骄傲
别那么骄傲 2021-01-05 02:15

I have 3 columns in a table called \"purchases\":

id         amount         price
2          2              21
2          5              9
3          8               


        
2条回答
  •  孤城傲影
    2021-01-05 03:04

    @sombe: I've just tested your query and it works just fine. Are you sure your mysql is up to date?

    alt text

    The second works fine too:

    alt text

提交回复
热议问题