Syntax error in a simple SQL query

All we need is an easy explanation of the problem, so here it is.

I am using pgAdmin to write a simple SQL INNER JOIN query. However, when I run the code it only will run the first line and give me a syntax error shown below. But, I can select the whole code and it will return the data I am looking for. How can I get this up and running so that I do not have to select the code I am trying to run every time?


SELECT * FROM payment
INNER JOIN customer
ON payment.customer_id = customer.customer_id;
ERROR: syntax error at or near "SELECT"
LINE 665: SELECT * FROM payment

SQL state: 42601
Character: 18909

How to solve :

I know you bored from this bug, So we are here to help you! Take a deep breath and look at the explanation of your problem. We have many solutions to this problem, But we recommend you to use the first method because it is tested & true method that will 100% work for you.

Method 1

Even though pqAdmin might not require ; at the end of a query, if you have multiple queries in the same script, ; might be required to separate the queries. This happens in MySQL and phpMyAdmin.

So, please add ; just before SELECT, and see if that works.

Note: Use and implement method 1 because this method fully tested our system.
Thank you 🙂

All methods was sourced from or, is licensed under cc by-sa 2.5, cc by-sa 3.0 and cc by-sa 4.0

Leave a Reply