简体   繁体   English

#1064-SQL连接2表问题

[英]#1064 - SQL join 2 table issue

I am not familiar with using sql. 我不熟悉使用sql。 May I know what the problem with this query? 我可以知道这个查询有什么问题吗? The code is as follows: 代码如下:

SELECT * 
FROM `products` 
JOIN 'cats' ON products.`cat_id` = cats.'id'
WHERE products.pro_name LIKE 'cats.name';

Try this: 尝试这个:

SELECT * FROM products 
JOIN cats 
ON products.cat_id = cats.id 
WHERE products.pro_name LIKE '%'+cats.name+'%'

Try this 尝试这个

SELECT * FROM products prod,cats cat ON 
products.cat_id = cat.id where products.pro_name LIKE '%'+cat.name

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM