Query 1 and 2 are similar to each another, except for the bolded part. Output of Query 1 is correct unlike Query 2, This is because of YAmend query. Is there anyway I could get the correct output without having to have YAmend query?

I tried to do this in Query 2 but it gives me some more records that shouldn