mysql连接基本问题
我有一个非常基本的问题,我想需要加入才能解决。不过我对 mysql 很陌生!这是我需要完成的:
我有 3 个表:
Products
、attributes
和 products_to_attributes
我需要做的是选择属性它们与我想要查询的产品相关联,基于 products_to_attributes
表。
假设我的产品 id=1
,我需要根据 products_to_attributes
表获取属性表中的所有行,该表仅保存 pid 以提供帮助。
I have a pretty basic question that I imagine would require a join to pull off. However I am very new to mysql! Here is what I need to pull off:
I have 3 tables:
Products
, attributes
, and products_to_attributes
What I need to do is select the attributes which are associated to the product I want to query, based off the products_to_attributes
table.
So lets say my product id=1
, I need to grab all the rows in the attributes tables based off the products_to_attributes
table which simply holds the pid to aid.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
它与 tofutim 的答案基本上相同,但不使用
INNER JOIN
语法。it's basically the same answer as tofutim, but without using the
INNER JOIN
syntax.