How can I perform this aggregate?

前端 未结 1 356
粉色の甜心
粉色の甜心 2021-01-28 00:52

I have crated two table one is customers and the other one is ord

select * from customers;

    id  Name    age     adress  salary
2   102 jpj     24      zzzz           


        
相关标签:
1条回答
  • 2021-01-28 01:20

    You need to group the data; for example:

    select c.name,c.id,sum(o.amount) as amount
    from CUSTOMERS c
    inner join ord o on c.id=o.customer_id
    group by c.id, c.name
    
    0 讨论(0)
提交回复
热议问题