Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

419
Views
Don't know why the error is always there, inner join issue?
SELECT bookingid, customer.customerid, flightid, numseats, firstname, surname, billingadress, email
FROM flightbooking, leadcustoemr;
INNER JOIN customerid ON flighbooking.customerid = leadcustomer.customerid;

I get a syntax error at or near "SELECT" when i run it in PG Admin 4, where is the problem, i think it is in the inner join, but unsure.

over 4 years ago · Santiago Trujillo
2 answers
Answer question

0

You have a semicolon after leadcustomer (which seems to have a typo itself) - that ends your select statement and the inner join isn't included (in addition, the inner join isn't using the correct table names). Also in the select you are using a column from the customer table (and that table is not joined at all).

I think you are trying to join the flightbooking and leadcustomer tables with the Inner Join and not actually trying to add in a third table. I edited your query here:

SELECT bookingid, flightbooking.customerid, flightid, numseats,
   firstname, surname, billingadress, email
FROM flightbooking
INNER JOIN leadcustomer ON (flightbooking.customerid = leadcustomer.customerid);
over 4 years ago · Santiago Trujillo Report

0

The syntax for join has two forms according to this: https://www.postgresql.org/docs/current/static/tutorial-join.html

SELECT *
FROM A, B
WHERE A.id = B.id;

So rewriting the query according to above syntax:

 SELECT bookingid, customer.customerid, flightid, numseats, firstname, 
 surname, billingadress, email
 FROM flightbooking, leadcustomer
 WHERE flightbooking.customerid= leadcustomer.customerid

more standard syntax is:

SELECT *
FROM A
INNER JOIN B
ON A.id = B.id

So rewriting the query results in:

SELECT bookingid, customer.customerid, flightid, numseats, firstname, surname, 
billingadress, email
FROM flightbooking
INNER JOIN  leadcustomer 
ON flighbooking.customerid = leadcustomer.customerid;`

and you could use aliases to make it shorter:

SELECT bookingid, customer.customerid, flightid, numseats, firstname, surname, 
billingadress, email
FROM flightbooking fb
INNER JOIN  leadcustomer  lc
ON fb.customerid = lc.customerid;
over 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!