SyntaxFix
Write A Post
Hire A Developer
Questions
Use IsNull
SELECT recordid, MIN(startdate), MAX(IsNull(enddate, Getdate())) FROM tmp GROUP BY recordid
I've modified MIN in the second instruction to MAX