I'm using IMPORTRANGE and in one of the columns there are duplicates. I only want to show the row from the duplicates that has the lowest value based on another column.

My current query:
=QUERY(IMPORTRANGE("google.com/spreadsheets/d/x/edit","sheet name"),"Select Col1,Col4,Col7,Col5,Col15 where Col5 contains 'some text' and Col15 contains 'some other text' and Col4 is not null order by Col4 asc")
Based on the earlier illustration, Col4 is A and Col7 is B.
I would greatly appreciate if you could tell me how to edit the existing query.