你在找一个 UNION ALL ``` select project, null as milestone, null as change from projects union all select project, milestone, null as change from milestones union all select project, null as milestone, change from changes
select p.project, null as milestone, null as change
from projects p
where not exists (select 1 from milestones m where m.project = p.project) and
not exists (select 1 from changes c where c.project = p.project)
union all
select m.project, m.milestone, null as change
from milestones
union all
select c.project, null as milestone, c.change
from changes;
2条答案
按热度按时间i2byvkas1#
你在找一个
UNION ALL
```select project, null as milestone, null as change
from projects
union all
select project, milestone, null as change
from milestones
union all
select project, null as milestone, change
from changes
7rfyedvj2#
根据你的结果,你似乎想要:
这是因为您的结果没有行:
所以你似乎只想和我吵架
projects
当其他表中没有相应的行时。