如果我要将这些表行放在一起,则会出现以下错误
[SQLITE_ERROR] SQL错误或数据库丢失(输入不完整)
每个人都单独工作。
SELECT x.ActionListId, x.wordindexed, x.word, x.wordreplacement
from Words x
where x.wordindexed like "%Hallo %"
limit 1
union all
SELECT p.ActionListId, p.wordindexed, p.word, p.wordreplacement
from Words p
where p.word like "%Tool%"
limit 1;
答案 0 :(得分:1)
这里的一种选择是包装当前的子查询,然后对其进行并集:
SELECT ActionListId, wordindexed, word, wordreplacement
FROM
(
SELECT *
FROM Words
WHERE wordindexed LIKE "%Hallo %"
LIMIT 1
) t1
UNION ALL
SELECT ActionListId, wordindexed, word, wordreplacement
FROM
(
SELECT *
FROM Words
WHERE wordindexed LIKE "%Tool %"
LIMIT 1
) t2;
这里是一个演示链接,显示此语法有效: