MySQL UNION与UNION ALL

时间:2019-12-07 17:12:30

标签: mysql union union-all

我似乎无法从几个查询中获得全部结果。

我试图多次获取所有相关段落,以便找到最相关的段落。

这将返回几个不同的答案:

select paragraph from lyrics where word=-2 and song=3
UNION 
select paragraph from lyrics where word=92 and song=3
UNION 
select paragraph from lyrics where word=208 and song=3

这不会返回任何答案:

select paragraph from lyrics where word=-2 and song=3
UNION ALL
select paragraph from lyrics where word=92 and song=3
UNION ALL
select paragraph from lyrics where word=208 and song=3

我试图在select语句周围添加括号,但返回错误。

编辑:删除了第一行,我添加了它们。

0 个答案:

没有答案