我的网站是一种字典。搜索关键字时,我想同时查看“单词”和“含义”列并显示与单词或含义匹配的所有内容。
select count(id) words where word like @keyword or meaning like @keyword
select * from words where word like @keyword or meaning like @keyword order by word
但我想先显示匹配的单词,然后显示匹配的含义。顺序不正确
当我将它们分开时:
select count(id) words where word like @keyword
select * from words where word like @keyword order by word
select count(id) words where meaning like @keyword
select * from words where meaning like @keyword order by word
这样就有重复(当关键字匹配单词和含义时)
当我再次联合它们时,顺序将不正确
如何才能做到这一点?我需要不同匹配结果的计数+不同匹配结果本身,但首先显示匹配词,然后显示匹配含义。