您好我有一个包含以下信息的数据库表:
owner.primaryitowner, (bobsmith@mail.com)
owner.secondaryitowner,
owner.primarybusinessowner,
owner.secondarybusinessowner
users.username (email bobsmith@mail.com)
users.displayname (e.g. Bob Smith)
问题是所有者仅存储为电子邮件。我通常还有另一张桌子
inner join users on users.username = owner.primaryitowner to get users.displayname
所以数据读取正确。`
我能够做到这一点
select u.displayname
from users u
inner join owners o on
o.primaryitowner = u.username
or o.secondaryitowner = u.username
or o.primarybusinessowner = u.username
or o.secondarybusinessowner = u.username
问题是我需要有唯一的列而不是全部放在一列中。
PS 我不能更改数据库我只是一个报告作者。
非常感谢提前