Please, I want to find another way
Sample data
| date | tomato | Telephone | Book | Pen |
|---|---|---|---|---|
| 2022-05-15 | 2 | 2 | 3 | 1 |
| 2022-05-15 | 3 | 3 | 3 | 2 |
I saw this result
| date | tomato | Telephone | Book | Pen |
|---|---|---|---|---|
| 2022-05-15 | 5 | 5 | 6 | 3 |
I use this
insert into sales.copy
select date,
sum(tomato),
sum(phone),
sum(book),
sum(pen)
from copy
where date = '2022-05-15';
delete from sales.copy
where date = '2022-05-15'
LIMIT 2;
But I want another way to explain this part briefly
'date, sum(tomato), sum(phone)...'
So just group the results
select date, sum(tomato), sum(phone), sum(book), sum(pen) from copy where date = '2022-05-15' GROUP BY date