SELECT ROW_NUMBER() OVER (ORDER BY A.KickoffDate DESC) AS RowNo,A.PNum,A.PName,A.KickOffDate,A.PlanDate,A.DepartmentNo,A.CreatorNo,
--B.ItemNo,B.ItemName,B.KickOffDate,B.PlanDate,B.EngineerNo,B.AdvisorNo,
C.HistoryID
FROM Project AS A
INNER JOIN PItem AS B ON A.PNum=B.PNum
INNER JOIN PHistory AS C ON A.PNum=C.PNum And C.HistoryID > '0'
where A.CateMainID='1' and A.ReleaseDate is null
以上这样写会出现重复的PNum
--group by A.PNum
而加这行会错误
要怎么改才行?
语法总还是觉得怪怪的,因为A对B和B对C都是一对多,
还是要在Select后再Select后再Select,做三层Select?
[此贴子已经被作者于2019-9-30 16:10编辑过]