您好我有一個具有以下信息的數據庫表:表的多個外鍵連接mysql中1個foriegn關鍵
owner.primaryitowner, ([email protected])
owner.secondaryitowner,
owner.primarybusinessowner,
owner.secondarybusinessowner
users.username (email [email protected])
users.displayname (e.g. Bob Smith)
問題,是業主只存儲爲電子郵件。還有一個表,我通常
inner join users on users.username = owner.primaryitowner to get users.displayname
所以數據讀取correctly.`
我能夠做到這一點
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我不能改變數據庫我只是一個報告編寫者。
感謝這麼多提前
謝謝你是一個拯救生命的人! –