我在创建查询时遇到问题。以下是我想出的:
SELECT sitedata.sitecode Site,
projectdata.startdate Start,
projectdata.enddate End,
resourcedata.firstname PM_Name,
resourcedata.firstname Lead_Name,
rresourcedata.firstname Other_Name
FROM projectdata
JOIN sitedata
ON projectdata.siteid = sitedata.id
JOIN resourcedata
ON projectdata.pmid = resourcedata.id
OR projectdata.leadid = resourcedata.id
OR projectdata.otherid = resourcedata.id
WHERE startdate = '03/06/2013'
我的查询当前的输出如下:
Site PM_Name Lead_Name Other_Name
ST1 Joe Joe Joe
ST1 Jim Jim Jim
ST1 Bill Bill Bill
ST2 Lee Lee Lee
ST2 Jim Jim Jim
ST2 Bill Bill Bill
下面是我想要得到的输出:
Site PM_Name Lead_Name Other_Name
ST1 Jim Joe Bill
ST2 Bill Lee Jim