area96
asked on
SQL Count AS something WHERE something = value
Im getting an error in my SQL that says that I've haven't declared a column when I already have in my count..
ERROR: Invalid column name 'counting'.
ideas and ways round the problem?
Ta!
ERROR: Invalid column name 'counting'.
ideas and ways round the problem?
Ta!
(SELECT COUNT(schoolID) AS counting FROM Lessons WHERE register.txtSchoolID = Lessons.txtSchoolID ) AS counting
//then later...
WHERE counting > 1
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SELECT COUNT(schoolID) AS counting FROM Lessons
WHERE register.txtSchoolID = Lessons.txtSchoolID
having count(shoolid) > 1