SELECT a.RegNo ,a.Attendance ,COUNT(a.Attendance )AtCount FROM Attendence as a WHERE Attdate BETWEEN '2017-07-17' AND '2017-08-01'and a.Attendance='A' group by a.Attendance,a.RegNo order by a.Attendance
Msg 147, Level 15, State 1, Line 3 An aggregate may not appear in the WHERE clause unless it is in a subquery contained in a HAVING clause or a select list, and the column being aggregated is an outer reference.
<pre> SELECT a.RegNo ,a.Attendance ,COUNT(a.Attendance )AtCount FROM Attendence as a WHERE Attdate BETWEEN '2017-07-17' AND '2017-08-01'and a.Attendance='A' group by a.Attendance,a.RegNo order by a.Attendance
SELECT a.RegNo ,a.Attendance ,COUNT(a.Attendance )AtCount FROM Attendence as a WHERE Attdate BETWEEN '2017-07-17' AND '2017-08-01' group by a.Attendance,a.RegNo HAVING a.Attendance='A' order by a.Attendance
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)