始终通过查看SQL字符串进行故障排除-而不是构建SQL字符串的代码!
SELECt _id, title, name, favorite FROM table1 where favorite= 1 UNIOn ALLSELECt _id, title, name, favorite FROM table2 where favorite= 1
您需要
ALL与第二个之间有一个空格
SELECT。

始终通过查看SQL字符串进行故障排除-而不是构建SQL字符串的代码!
SELECt _id, title, name, favorite FROM table1 where favorite= 1 UNIOn ALLSELECt _id, title, name, favorite FROM table2 where favorite= 1
您需要
ALL与第二个之间有一个空格
SELECT。