我有两张这样的表
然后我从两个表中选择_id值
SELECT _id, name, phone, favorite FROM table_CN where _id='15'UNION SELECT _id, name, phone, favorite FROM table_EN where _id='15'
之后我不知道如何确定更新数据的表名,我可以用SQL查询吗?我在这里很困惑!
答案 0 :(得分:0)
您可以手动将表名添加到结果中:
SELECT _id, name, phone, favorite, 'table_CN' AS table_name FROM table_CN where _id='15' UNION
SELECT _id, name, phone, favorite, 'table_EN' AS table_name FROM table_EN where _id='15'
顺便说一下,有没有理由不使用_id, lang, name, phone, favorite, title, PRIMARY KEY (_id, lang)
这样的表格?