Update HSQL table values based on related table
问题 I have 2 related tables: "Universities"(id, num_courses) and "Courses" (id, university_id). I need University.num_courses to represent a COUNT of courses. I can query data I need: SELECT Universities.id, COUNT(Courses.university_id) as NumCourses FROM Courses JOIN Universities ON Universities.id = Courses.university_id GROUP BY Universities.id How do I UPDATE Universities with it? Could it be done automatically? 回答1: I am not sure this is what you mean by "automatically," but it can be done