如果在数据库中的单词nice car, nice, nice, nice car
和我们搜索词nice
:如何ORDER BY(上市)的,如:nice, nice, nice car, nice car
,或者搜索词nice car
ORDER BY(上市),如:nice car, nice car, nice, nice
?通过结果搜索命令?
- 词语的数据库:
nice car
,nice
,nice
,nice car
- 好的=>
nice
,nice
,nice car
,nice car
- 好车=>
nice car
,nice car
,nice
,nice
我的查询:
$find = $this->input->post('find');
$where = "name LIKE '%$find%' OR
star LIKE '%$find%' OR
address LIKE '%$find%'";
$query = $data['results'] = $this->db->query("SELECT @rownum:[email protected]+1 rownum, t.*
FROM (
SELECT *
FROM my_table
WHERE
$where
ORDER BY id desc
LIMIT $offset, $coun_page
) t,
(SELECT @rownum:=0) r");
如果你搜索单词'nice car',select语句将不会返回任何'很好'的记录 – Andrey