SQLTeam.com | Weblogs | Forums

Query for yearly

Please help me in getting month names with dates

What have you tried so far? Where are you having issues with writing the code for the question?
Provide sample data not as an image but ddl and dml

I tried login in function but not getting idea

Which function? Please provide sample data as

create table #sample

 insert into #sample

Okay I created table and inserted data also but I'm not getting the output as I mentioned above..
First I have to take max values and then adding the max values of XX columns

I not getting the idea to get the max values of same dates

You have the data but we dont? Please provide sample data for usto help you?

Create table sample
Date datetime,
XX int

Insert into sample values

('2021-01-01 09:00:00.000 ' 1)
('2021-01-01 10:00:00.000 ' 2)
('2021-02-01 09:00:00.000 ' 5)
('2021-02-01 10:00:00.000 ' 2)
('2021-01-02 09:00:00.000 ' 6)
('2021-01-02 10:00:00.000 ' 1)
('2021-02-02 09:00:00.000 ' 8)
('2021-02-02 10:00:00.000' 1)

hi .. vasu ..

hope this helps ...

SELECT Cast(date AS DATE),
FROM   sample
GROUP  BY Cast(date AS DATE) 


Okay sir thank you