Search code examples
sqlpostgresqlpostgresql-10postgresql-12

syntax error at or near "JOIN" for postgresql


I am trying to join two tables, and for some reason I keeping getting:

ERROR: syntax error at or near "JOIN"

My code is:

SELECT
    c.visit,
    d.cake
FROM 
    customer c, 
INNER JOIN desert d 
    ON c.visit = d.visit
LIMIT 10;

Solution

  • The comma is unnecessary:

    SELECT
        c.visit,
        d.cake
    FROM 
        customer c -- here
    INNER JOIN desert d 
        ON c.visit = d.visit
    LIMIT 10;