gpt4 book ai didi

java - android.database.sqlite.SQLiteException : near "UNION": syntax error

转载 作者:行者123 更新时间:2023-12-02 01:43:44 25 4
gpt4 key购买 nike

我正在使用适用于 Android 的 SQLite 数据库

SQLite 查询

SELECT t1.id,t1.name, t1.email FROM ((SELECT id,first_name as 
name,email FROM single_general where unique_code='UD')
UNION ALL (SELECT name,email FROM school where
unique_code='UD') ) t1

最佳答案

SELECT syntax复合查询不允许使用括号。删除它们,以便只留下子查询周围的括号:

SELECT id, name, email
FROM (SELECT id, first_name AS name, email
FROM single_general
WHERE unique_code = 'UD'
UNION ALL
SELECT 0, name, email
FROM school
WHERE unique_code = 'UD');

关于java - android.database.sqlite.SQLiteException : near "UNION": syntax error,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54039529/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com