使用关键字和位置从给定的mysql数据库中检索位置,图像和名称的查询。
我已经尝试过这个查询:
"select * from tb_user inner join tb_category on tb_user.category_id=tb_category.category_id inner join tb_subcategory on tb_user.subcategory_id=tb_subcategory.subcategory_id inner join tb_location on tb_user.location_id=tb_location.location_id where tb_user.keyword like '%$keyword%' or tb_category.category_name like '%$keyword%' or tb_subcategory.subcategory_name like '%$keyword%' or tb_location.location_name like '%$location%'";
答案 0 :(得分:0)
select * from tb_user
LEFT join tb_category on tb_user.category_id=tb_category.category_id
LEFT join tb_subcategory on tb_user.subcategory_id=tb_subcategory.subcategory_id
LEFT join tb_location on tb_user.location_id=tb_location.location_id
where tb_user.keyword like '%$keyword%'
or tb_category.category_name like '%$keyword%'
or tb_subcategory.subcategory_name like '%$keyword%'
or tb_location.location_name like '%$location%'
尝试以上查询。