Skip to main content
Cadet | Tier 2
August 20, 2023
Question

How to do an inner join

  • August 20, 2023
  • 15 replies
  • 486 views

Hello, I would like to join two tables with the id as a key using the inner join, but when I try to do so, it doesn’t return any results even though it should return something. I woule like to know what is the correct syntaxis for this, I am using

 

SELECT * FROM "Table1" INNER JOIN "Table2" ON 'Table1.Table2_id' = 'Table2.id';

Thank you!

15 replies

Navigator | Tier 3
August 21, 2023

Postgres is case-sensitive. Is the field names and table names identical?
SELECT *
FROM "People"
INNER JOIN "MasterPeople" ON "People"."MasterPeople_idPerson" = "MasterPeople"."idPerson";

Cadet | Tier 2
August 21, 2023

Yes, the names are identical. As an example when I use just the select * and the name of the tables it works perfectly, the issue is with this inner join 

Navigator | Tier 3
August 21, 2023

what about the field names?

Cadet | Tier 2
August 21, 2023

Yes, everything is identical. I made sure of it several times

Navigator | Tier 3
August 21, 2023

Can you give me a Select query with the fields of the table individually with *?

Bit challenging to know the issue without seeing the tables.