i would like to join two tables that have a common column for example "custcode". The table "customer" is filled with some customer data and the table "customer_address" with the customer addresses.Basically I would like to join the data of these tables so that I can export it.
here is a query that I have tried
SELECT
*
FROM
"customer"
INNER JOIN 'customer_address' ON 'customer'.'custcode' = 'customer'.'custcode'
LIMIT
1000
2
Answers
The JOIN condition is not correct, you’re referencing the table "customer" twice. You have to reference the other table:
Another option is to use USING():
You don’t need, nor want, double quotes " around your object names. Single quotes ‘ are used for content, not for object names.
The query you provided has a couple of issues. First, you should use backticks (`) or square brackets ([ ]) to escape column and table names with spaces or special characters, not single quotes (‘ ‘). Second, it seems like you are using single quotes around the table names ‘customer’ and ‘customer_address,’ which would treat them as string literals, not table names