DECLARE @tbltemp TABLE(
ID INT PRIMARY KEY IDENTITY(1,1), Name VARCHAR(MAX) DEFAULT '',Admission date
)
INSERT INTO @tbltemp(Name, Admission)
Values('manu',getdate()),
('raju',getdate()+2),
('lohith',getdate()-30),
('venu',getdate()+2),
('madhav',getdate()-30)
Select entrydate,count(Id) as noofstudents
FROM (
Select Id,Name,Admission as entrydate from @tbltemp
) subdata
group by entrydate
Comments
Post a Comment