Hi Everyone,
I have this code that I use for Vb.net and it used to work fine but now it shows results not in ascending way.
This is the code :
AS
Begin
SELECT
Sum(Price) As Total,
DATEPART(yyyy, Date) As [year],
Sum (CONVERT(INT, CONVERT(VARCHAR(MAX),quantity))) as Lesh
FROM
dbo.Expenses
WHERE
Date >= DATEADD(year, -12, GETDATE())
GROUP BY
DATEPART(yyyy, Date)
End
and these is the results
7566.53 2021 163
187.20 2016 13
17346.86 2019 1135
18594.50 2020 1933
13760.48 2017 224
12975.71 2018 277
I want to have the results like:
2021
2020
2019
2018
2017
2016
Thank you, Best regards