Using UNION ALL
with Queries with different number of column returns the following error sqlite3.OperationalError: SELECTs to the left and right of UNION ALL do not have the same number of result columns
.
I tried
this answer but I think that is now outdated and does not work. I tried to find something in the documentation but I couldn't find it.
Both UNION
and UNION ALL
do not work.
This answer is a bit complex for me to understand.
What would be the workaround to achieve this? A Column with Null
- how do I do that ?
Update:
Also, I don't know the no. or name of tables as in my program I allow the user to create and manipulate data. To find out the queries in the database, I Use:
SELECT name FROM sqlite_master WHERE type='table';
and to find out the columns I use this:
[i[0] for i in cursor.description]