To try to isolate the error, I would try. See if it can match Location.BusID = MD.BusID.
SELECT MD.*, Contact.FirstName FROM MerchantData MD JOIN Merchant M ON M.MerchID = MD.MerchID JOIN Location On Location.BusID = MD.BusID
You are not using *, so use
SELECT TOP 1 Location.BusID FROM Location WHERE Location.BusID = MD.BusID
As soon as you get the syntax.
You know that as soon as you get this work, it will only correspond to the first line, and then check whether it is deleted. The problem is that without ordering on the "first" line is arbitrary. Even with a clustered table index, there is no guaranteed sorting without an order by clause. To get a repeatable answer, you need a view. But if you sort and want only the top row, then MAX or MIN and the group will be more direct.
If you want to deal with only one or more remote locations, then the following should work, but you need to split the columns for the group. If two remote locations have a different contact name, it will report all. So this may not be what you are looking for.
SELECT MD.col1, MD.col2, Contact.FirstName FROM MerchantData MD JOIN Merchant M ON M.MerchID = MD.MerchID JOIN Location L ON L.BusID = MD.BusID AND L.Deleted = 0 JOIN Contact ON Contact.ContactID = L.PrincipalID GROUP BY MD.col1, MD.col2, Contact.FirstName
source share