Reputation: 1
Table1: Contractors
Contractor_No; -- PK
Contractor;
Table2: Contracts
Contract_No; -- PK
ProjDesc;
Contractor_No; -- FK
How to retrieve data by joining these 2 table with Contractor (from Table1), Contract_No, ProjDesc from (Table2)?
My SQL statment:
select a.Contractor, b.ProjDesc
from Contractors a, Contracts b
join Contractor a on a.Contractor_No = b.Contractor_No and b.Contract_No='1234';
Upvotes: 0
Views: 64
Reputation: 1234
select a.Contractor,
b.ProjDesc
from Constractors a
inner join contracts b on
a.contractor_no = b.contractor_no
where b.contract_no = '1234'
Upvotes: 1
Reputation: 44581
You have some syntax errors:
SELECT a.Contractor
, b.ProjDesc
FROM Contractors a
JOIN Contracts b ON a.Contractor_No = b.Contractor_No
AND b.Contract_No = '1234'
Upvotes: 2