I’m relatively new to sql so this may probably come off as a simple questions.
I have 3 tables A,B,C
B has a FK to A, and C has a FK to B
I would like to get all the distinct entries in A that has an entry in B that corresponds to an entry in C. With JOINs I currently have:
SELECT DISTINCT *
FROM Peoples p
INNER JOIN Contracts c
ON p.pkey=c.person_pkey
JOIN audits a ON c.contract_pkey=a.contract_issued_for;
So this returns the list of all people (with duplicates) with an audit. How do I get it so that instead of return columns of all the tables put together, but rather just all the columns that belong to table peoples and are unique entries?
Thanks in advance!
Replace
with