Benjamin Coleman
Benjamin Coleman

Reputation: 29

PostgreSQL get matches from two tables and save to disk

Sorry for noob question, yes, i've google Joins in sql, but i don't understand syntax error. So please help me.

I have 2 tables eng_data_table with key column and get with get column

I just want to get matches from get founded in eng_data_table.keyword and save it to disk. So this is

COPY ( SELECT * FROM "eng_data_table.key" INNER JOIN "get.get" ) TO 'founded.txt';

Right? No, i have a syntax error

ERROR:  syntax error at or near ")"
                                ^

Why he don't like it?

Upvotes: 0

Views: 32

Answers (1)

JNevill
JNevill

Reputation: 50263

When you join two tables you have to specify which fields they share in common with an ON clause. In your attempt you list those fields in the JOIN itself where only the table names belong.

Instead:

SELECT * FROM eng_data_table INNER JOIN get ON eng_data_table.key = get.get

Upvotes: 0

Related Questions