我四处寻找适合我正在寻找的东西。我绝不接近 SQL 专家,所以我在这里问。无论 c 是否存在,我都想抓住 a 和 b,但如果 c 确实存在,则将其加入返回。这是我目前正在使用的声明:
SELECT a.display_name, a.first_name, a.last_name, a.profile_image, a.tagline,
a.bragging_rights, a.about_me, b.type AS post_type, b.title AS post_title,
b.published AS post_published, b.updated AS post_updated,
b.content AS post_content, b.num_replies AS post_replies,
b.num_plus_ones AS post_plus_ones, b.num_reshares AS post_reshares,
c.display_name AS attach_display_name, c.content AS attach_content,
c.url AS attach_url, c.image_url AS attach_image,
c.image_width AS attach_width, c.image_height AS attach_height,
c.full_image_url AS attach_full_image
FROM cr_google_profiles a
JOIN cr_google_posts b
LEFT JOIN cr_google_post_attachements c
ON b.post_id = c.post_id
WHERE a.google_id = :google_id AND b.google_id = :google_id AND c.google_id = :google_id
我真的不知道如何做到这一点;我一直在 YouTubing 并阅读手册,但没有想出任何可以完成我正在寻找的东西。任何帮助或建设性的批评都非常受欢迎。