NYCPHP Meetup

NYPHP.org

[nycphp-talk] SQL question

David Krings ramons at gmx.net
Mon Jul 23 15:45:13 EDT 2007


Rob Marscher wrote:
> SELECT
>   s.StoryboardID
>> FROM cupscourses c
>   LEFT JOIN cupsmodules m ON m.CourseID = c.CourseID
>   LEFT JOIN cupslessons l ON l.ModuleID = m.ModuleID
>   LEFT JOIN cupspages p ON p.LessonID = l.LessonID
>   LEFT JOIN cupsstoryboards s ON s.PageID = p.PageID
> WHERE c.CourseID = 23
> ORDER BY m.Module_Position, l.Lesson_Position, p.Page_Position
> 

Dingdingding! The left join really did the trick and I now get what I 
expect to get. So, I guess now that I got this settled I better learn 
what a left join is in case someone asks me to explain my code. :)

Thanks to everyone who replied!

David



More information about the talk mailing list