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.
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);
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;