For the test data you provided, the last line is not necessary. I added it as an extra check.
Say for example project 1425 has a third line with demo_code DE2, than this extra row is not returned.
Need an answer? No, you need a question
My blog at https://sqlkover.com.
MCSE Business Intelligence - Microsoft Data Platform MVP