M
M
Meynr2020-12-19 13:06:10
SQL Server
Meynr, 2020-12-19 13:06:10

How to determine by how many units the supply of goods for a specified year increased compared to the previous one?

It is necessary to determine by how many units the supply of the product 'headphones' increased in 2001 compared to the previous year.

I started to do it, but I see that I’m not doing what I need to do at all.

SELECT Sum(Postavki.Kol_tovara) AS [Sum-Количество_товара],
DatePart(yy,[Postavki].[date]) AS Год 
FROM tovar
INNER JOIN Postavki ON tovar.[id_tovar] = Postavki.id_tovar
WHERE (((tovar.Nazva_tovara)='наушники')) 
GROUP BY DatePart(yy,[Postavki].[date]);


Diagram of my base:
5fddd02db3b03338960856.png

Answer the question

In order to leave comments, you need to log in

1 answer(s)
V
Vasily Bannikov, 2020-12-19
@vabka

Sum up deliveries for 2001 and subtract from them the sum of deliveries for 2000

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question