我有一个包含id,recipe_name,recipe_ingredients字段的食谱表格,我加入这些表格是为了搜索特定的食谱。
我的问题是:“我如何在like查询中仅使用”面条“来搜索Veg面条,简易面条等?
我的问题是:
SELECT r.*,l.*,CASE WHEN (COUNT(l.recipe_id)=0)THEN 0 ELSE 1 END as like_status,
u.name,u.user_image,u.location,u.contact_no,COUNT(l.recipe_id) as total_likes
FROM recipe as r
LEFT JOIN likes as l ON r.recipe_id = l.recipe_id
LEFT JOIN user_detail as u ON r.user_id = u.user_id
WHERE r.recipe_name LIKE '%$search%'
我的上面的查询只返回包含“.I”的数据,在上面的查询中已经尝试过使用replace替换空格,而不是luck.So。我如何使用LIKE搜索包含所有空格和空格?
发布于 2015-06-18 16:46:50
我们可以像这样使用
select * from table_name where table_name like "%Veg Noodles%"
我认为这些SQL很有用
谢谢。
https://stackoverflow.com/questions/30910431
复制相似问题