如果在數據庫中的單詞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