I have a problem with database query?
Here is the Scenario
This is a TeacherClass Table (Parent Table)(id)

And This is a ClassSchedule Table(Child table)(teacher_class_id is a foreign key)

I want to find out the the latest date from ClassSchedule Table for each class and order by class_schdule_date(latest date).
(It would be better for me if you write the query in cackphp query syntax.)
Please Help me.
This requires a straightforward join:
You can select other columns from the TeacherClass table as you like – just add them to the group by clause too.
Note that
left joinis required in case there are no scheduled dates for the class, you still get a row for the class (but the max scheduled date will be null)