匹配查询在laravel 4.2中无法正常工作

时间:2015-09-19 06:14:18

标签: php mysql sql laravel laravel-4

我遇到与查询匹配的问题,代码如下。

    select
    `b`.`name` as `resNm`,
    `s`.`name` as `suburbs`,
    `b`.`city`
from
    `businesses` as `b`
left join `suburbs` as `s`
    on `s`.`id` = `s`.`id`
where
    (
        MATCH (`b`.`suburb`, `b`.`city`, `s`.`name`) AGAINST ('road number 12' IN BOOLEAN MODE)
    ) and
    MATCH (delivery_areas, `s`.`name`) AGAINST ('road number 12' IN BOOLEAN MODE) AND 
    `is_bolo` = 1
group by
    `s`.`name`
order by
    `s`.`level` desc,
    `s`.`name` asc 

获取所有记录表单数据库

我的原始查询如下。

select
    `b`.`name` as `resNm`,
    `s`.`name` as `suburbs`,
    `b`.`city`
from
    `businesses` as `b`
left join `suburbs` as `s`
    on `s`.`id` = `s`.`id`
where
    (
        `b`.`suburb` like '%road number 12%' or
        `b`.`city` like '%road number 12%' or
        `s`.`name` like '%road number 12%'
    ) and
    `delivery_areas` like '%road number 12%' and
    `is_bolo` = 1 and
    `s`.`name` like '%road number 12%'
group by
    `s`.`name`
order by
    `s`.`level` desc,
    `s`.`name` asc

我喜欢跟随记录。

如果用户搜索road no 12然后获取郊区,名称,城市等记录,则传送区域包含类似“道路”的记录。或者喜欢'数字'或喜欢' 12'或者喜欢“没有”#39;等

请帮帮我。

提前致谢。

0 个答案:

没有答案