Description:
In this example we explain that how to group by with
alias column name in SQL Server query. Or group by on alias column in SQL Server.
Or SQL Server example to Group by alias column name in SQL query.
Sometime we have requirement like required or fetch
data in SQL Server but in alias column name. Below is the query that
demonstrates the Group by data in SQL Server with alias column name.
Query:
INSERT INTO @Emptemp(EmpId,Emp_Name, JoinDate)
Values('E001','Kirit Patel',getdate()),
('E002','Pintu Patel',getdate()+7),
('E003','Rohit Chauhan Sai',getdate()-30),
('E004','Nick Shah',getdate()+7),
('E005','Raju Maheta',getdate()-30)
Select Joindate,count(Id) as NoOfEmployees
FROM (
Select EmpId,Emp_Name,JoinDate
as Joindate from
@Emptemp
) empdata
group by Joindate
0 comments:
Post a Comment