根据这样的请求:
WITH t as(
SELECT a.Id,
a.Name,
a.Description,
b.Title,
c.Role
FROM aTable AS a
LEFT JOIN bTable AS b ON a.Id=b.uuid
LEFT JOIN cTable AS c ON b.uuid=c.roleId
WHERE c.role='major' OR c.role='captian'
GROUP BY a.Id)
SELECT t.Id,
t.Name,
t.Description,
t.Title,
t.Role,
d.Email
FROM t
LEFT JOIN dTable AS d ON t.Id=d.Guid
我收到两个角色的邮件(少校和上尉)。怎样只收船长的邮件?
我附上我的脚本的结果
和预期结果
1条答案
按热度按时间iklwldmw1#
使用
IF()
表达式。