I don't yet have a wide knowledge of all the possibilities in Cake, but I use an SQL VIEW to make multi-table joins easier. MySQL 5 supports SQL VIEWs.
Creating the SQL VIEW is done in advance, from the MySQL command line or from any admin utility such as eskuel or phpmyadmin. A working example: CREATE VIEW courses_students_teachers_scheduleblocks AS SELECT concat(courses_students.course_id,courses_students.student_id,courses.teacher_id,courses.scheduleblock_id) AS id, courses.scheduleblock_id AS scheduleblock_id, courses.id AS course_id, courses.subject AS subject, teachers.id AS teacher_id, teachers.teacher_fname AS teacher_fname, teachers.teacher_lname AS teacher_lname, students.id AS student_id, students.lname AS student_lname, students.fname AS student_fname FROM courses_students, courses, students, teachers, scheduleblocks WHERE ((courses.id = courses_students.course_id) AND (courses_students.student_id = students.id) AND (courses.teacher_id = teachers.id) AND (scheduleblocks.id = courses.scheduleblock_id)); This view can then be used to simplify queries that might otherwise be repetitious and harder to understand. If desired, a model and controller, even a Cake view, can be built for such an SQL VIEW, just as for an ordinary table - Cake does not know the difference, since I've synthesized an id by concatenating the ids from all the real tables. I don't know whether this view could be updated. I haven't tried. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Cake PHP" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php -~----------~----~----~----~------~----~------~--~---
