【发布时间】:2025-12-13 08:50:02
【问题描述】:
首先,我有 4 个表和列,例如
- 供稿(id、类型、type_id)
- feeds_normals(id、类型、内容)
- feeds_links(id、类型、标题、链接)
- feeds_youtubes(ID、类型、标题、链接、描述、图片)
- feeds_photos(ID、类型、链接)
“feeds type_id”表是法线、链接、youtube、照片的匹配/链接“id”
和
“feeds 类型”的表正在使用标识的应该加入哪个表
例如:
feeds:
id: 1, type: "normal", type_id: 1
id: 2, type: "link", type_id: 1
feeds_normals:
id: 1, type: "normal", content: "this is a test"
feeds_links:
id: 1, type: "link", title: "This is a title", link: "http://yahoo.com"
结果:
id: 1, type: "normal", content: "this is a test", title: NULL, link: NULL
id: 2, type: "link", content: NULL, title: "This is a title", link: "http://yahoo.com"
终于
这种情况下,SQL语句怎么写?
【问题讨论】: