The used SELECT statements have a different number of columns

后端 未结 5 1577
执笔经年
执笔经年 2021-01-11 13:28

For examples I don\'t know how many rows in each table are and I try to do like this:

SELECT * FROM members 
UNION 
SELECT * FROM inventory

5条回答
  •  失恋的感觉
    2021-01-11 13:47

    Put the columns names explicitly rather than *, and make sure the number of columns and data types match for the same column in each select.

    Update:

    I really don't think you want to be UNIONing those tables, based on the tables names. They don't seem to contain related data. If you post your schema and describe what you are trying to achieve it is likely we can provide better help.

提交回复
热议问题