Kyu.ki
Kyu.ki

Reputation: 47

Union more than two table in sql through Python.

I am trying to perform union over more than two tables using following query but I am getting syntax error.

"CREATE TABLE IF NOT EXISTS Xi(SELECT * FROM X UNION SELECT * FROM Y
UNION SELECT * FROM Z UNION SELECT * FROM W)"

I have also tried Insert but still getting some error.

Can someone please help me resolve this problem?

Upvotes: 0

Views: 644

Answers (1)

You need to create the table structure first and then insert the data with a sub-query. Have a look at this post: create new table with subquery select

Upvotes: 1

Related Questions