开发者

Check table name to update data (sqlite)

I have two table like this

  • table_CN (_id, name, phone, favorite, title)
  • table_EN (_id, name, phone, favorite)

Then I select _id value from two table

SELECT _id, name, phone, favorite FROM table_CN where _id='15'UNION SELECT _id, name, phone, favorite FROM table_EN where _id='15'

After that I don't know how to dete开发者_如何学Gormine which table name to update data, can I do that with SQL query? I'm confusing here!


You can add the table name to the result manually:

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'

Btw, is there a reason to not use a table like _id, lang, name, phone, favorite, title, PRIMARY KEY (_id, lang)?

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜