TABLE1
ID (PK) Name
1001 Sam
TABLE2
IDadd (FK) Country
1001 USA
1001 UK
My query:
SELECT A.Name, B.Country
FROM TABLE1 A
INNER JOIN (SELECT TOP 1 * FROM TABLE2 WHERE IDadd = A.ID) AS B
ON B.IDadd = A.ID
Basically, the query intends to get one of the records from TABLE2 and join it to TABLE1. However, I can’t get it to work.
Any help is highly appreciated!