Can anyone suggest what's wrong with this SQL code?
Select imrpartid, imrpartrevisionid from partrevisions inner join
( Select imrpartid, imrpartrevisionid, count (*) as cnt from partrevisions where imreffectiveenddate is null group by partrevisions.imrpartid,partrevisions.imrpartrevisionid) as ptr
on partrevisions.imrpartid = ptr.imrpartid and partrevisions.imrpartrevisionid = ptr.imrpartrevisionid where cnt >1
Select imrpartid, imrpartrevisionid from partrevisions inner join
( Select imrpartid, imrpartrevisionid, count (*) as cnt from partrevisions where imreffectiveenddate is null group by partrevisions.imrpartid,partrevisions.imrpartrevisionid) as ptr
on partrevisions.imrpartid = ptr.imrpartid and partrevisions.imrpartrevisionid = ptr.imrpartrevisionid where cnt >1