简体   繁体   中英

Trouble with OUTER JOIN and multiple tables

I have the following SQL, which works:

SELECT QuizFamilies.ID, QuizFamilies.Title
FROM QuizFamilies
LEFT OUTER JOIN Images ON QuizFamilies.ID = Images.ID

Now, I need to add an additional table (ImageData) to the outer join. (where Images.ID = ImageData.ID) in order to retrieve the column I need from it: ImagesData.Uri

I've tried all sorts of inner and outer combinations, but can't get it to work.

Just add another join:

SELECT QuizFamilies.ID, QuizFamilies.Title, ImageData.URI
FROM QuizFamilies
LEFT OUTER JOIN Images ON QuizFamilies.ID = Images.ID
LEFT OUTER JOIN ImageData on ImageData.ID = Images.ID

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM