Assistance with joining tables

Hi,

Would somebody be able to assist with an example sql query for this example question. of how to join and query these 3 tables and displaying the result.

Thanks in advance

For future reference, please follow the guidelines here:

If this is for a class or exam, we don't answer those questions on SQLTeam.com. At the very minimum you would need to post what you have attempted so far, and examples of data that demonstrate why it's not working as intended.

Additionally, the screenshot is hard to read, and the last part of the question is immaterial, and suggests using a bad query practice.

this is what i have so far: getting confued with joins

SELECT Business,StreetNo,Street,PostCode,FootfallCount
FROM Businesses
INNER JOIN Premises
ON Businesses.Id = Premises.Id;

Just imagine that every table is an excel-sheet and you need to look at it. So Businesses has an ID. You can find the value of 1000000026 in the table Premises in the field BusinessesId:

SELECT Business,StreetNo,Street,PostCode
FROM Businesses
INNER JOIN Premises
ON Businesses.Id = Premises.BusinessesId;

Next step is to join the Premises, 8016. You can find it in FootFall.PremisesId

SELECT
Businesses.Business,Premises.StreetNo,Premises.Street,Premises.PostCode, Footfall.[Count]
FROM Businesses
INNER JOIN Premises
ON Businesses.Id = Premises.BusinessesId;
INNER JOIN FootFall
ON FootFall.PremisesId=Premises.ID

Thanks you for your help and example

I was getting there (slowly) it is making sense now.

Paul