I have 4 tables and the following SQL query:
SELECT * FROM dbo.Synola, dbo.Stores, dbo.Fpa, dbo.Nomismata
WHERE
dbo.Stores.Store_id = dbo.Synola.Store_id
AND
dbo.Stores.fpa_id = dbo.Fpa.fpa_id
AND
dbo.Stores.nomisma_id = dbo.Nomismata.nomisma_id
The above works fine and without errors.
My problem is that when I am trying to loop the above query:
Currently, in my Stores TABLE, I have only 2 stores and I want in the loop to get results ONLY for 2 records. The 2 records with my 2 stores. But unfortunately I am receiving more than 2 records.
Which is the correct syntax of my query in a way to receive results only for my 2 stores in the loop?