SQL问题需要在一列中添加值,并在另一列中添加列后删除重复项
我想根据删除另一列中的重复项添加列值 需要如下所示的数据: 这称为“聚合”。你可以这样做:SQL问题需要在一列中添加值,并在另一列中添加列后删除重复项,sql,Sql,我想根据删除另一列中的重复项添加列值 需要如下所示的数据: 这称为“聚合”。你可以这样做: select name, max(date) as date, -- MAX() gets the max value from the group sum(expense) as expense -- SUM() adds up all the values of the group from t group by name 这就是所谓的“聚合”。你可以这样做: select name
select
name,
max(date) as date, -- MAX() gets the max value from the group
sum(expense) as expense -- SUM() adds up all the values of the group
from t
group by name
这就是所谓的“聚合”。你可以这样做:
select
name,
max(date) as date, -- MAX() gets the max value from the group
sum(expense) as expense -- SUM() adds up all the values of the group
from t
group by name