Hallo,
I have this code that I use in SQL and show a chart based on this code but the thing is that when I use it in ASC way or DESC way it goes by the name of the week day and not by the number of the week.
this is the code:
SELECT SUM(Hours) as 'Total'
,CONVERT(char(7), date, 120) AS 'year',
FORMAT(Date, 'ddd', 'en-US') + '/' + CONVERT(VARCHAR(5),DATEPART(DAY,Date)) AS 'Day'
FROM Hemingways
WHERE CONVERT(char(7), date, 120) = '2021-07' OR '2021' IS NULL
GROUP BY CONVERT(char(7), date, 120), FORMAT(Date, 'ddd', 'en-US') + '/' + CONVERT(VARCHAR(5),DATEPART(DAY,Date)),
CONVERT(INT,DATEPART(DAY,Date))
order by CONVERT(INT,DATEPART(DAY,Date)) ASC
and this is the results:
Total | year | Day
4.50 2021-07 Fri/9
3.50 2021-07 Fri/16
4.00 2021-07 Sat/17
what i want is that the results for the Day is like this :
Total | year | Day
4.50 2021-07 9/Fri
3.50 2021-07 16/Fri
4.00 2021-07 17/Sat
Your help is much appriciated.