Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
*使用时是否可以使用JOIN。到目前为止,我使用以下结果
*
JOIN
SELECT * FROM default_ps_products_categories INNER JOIN default_ps_products_brand_by_cat
但我希望它返回一个,而不是如图所示的两个 - 我是否必须正确执行查询并选择表?匹配的两个列是id和cat_id
id
cat_id
您缺少ON连接中的子句,在这种情况下 MySQL 返回完整的笛卡尔连接而不是抱怨。
ON
尝试(我使用别名,因为表名很长):
SELECT * FROM default_ps_products_categories C INNER JOIN default_ps_products_brand_by_cat B ON C.id = B.cat_id
注意:这*很好,不是问题的根源。