Why would you need to use UNION?
The queries are all against the same table; do it as a single SELECT against the table. Use AND
and/or OR
logical operators to combine the predicates.
To get rows from the table that satisfy any of the conditions:
SELECT a.Title
, a.AlbumDescription
FROM Albums a
WHERE MATCH(a.AlbumDescription) AGAINST('blondes')
OR MATCH(a.AlbumDescription) AGAINST('bodybags')
OR MATCH(a.AlbumDescription) AGAINST('fireplaces' WITH QUERY EXPANSION)
OR MATCH(a.AlbumDescription) AGAINST('sighing' WITH QUERY EXPANSION)
Here's an example of the UNION
set operator to combine the results from four queries:
SELECT a.Title
, a.AlbumDescription
FROM Albums a
WHERE MATCH(a.AlbumDescription) AGAINST('blondes')
UNION
SELECT a.Title
, a.AlbumDescription
FROM Albums a
WHERE MATCH(a.AlbumDescription) AGAINST('bodybags')
UNION
SELECT a.Title
, a.AlbumDescription
FROM Albums a
WHERE MATCH(a.AlbumDescription) AGAINST('sighing' WITH QUERY EXPANSION)
UNION
SELECT a.Title
, a.AlbumDescription
FROM Albums a
WHERE MATCH(a.AlbumDescription) AGAINST('sighing' WITH QUERY EXPANSION)