我有两张桌子:歌曲和歌手
这是我的查询:
Select * FROM (
SELECT
idx,
name,
IDsinger,
permission,
(name LIKE '%XXX%') As relevancy,
'table1' As t
FROM `songs`
where
isActive<>'0' AND name LIKE '%XXX%'
UNION
SELECT
idx,
name,
CreationDate,
permission,
(name LIKE '%XXX%') As relevancy,
'table2' As t
FROM `singers`
WHERE isActive<>'0' AND name LIKE '%XXX%'
) AS X
order by relevancy LIMIT 10
问题是如果我写“akon孤独”没有找到结果。
但是如果我写“akon”或“lonely”就会找到结果。
我会喜欢改进查询的建议..
谢谢