一个sql关联查询的问题。求解
目前有三张表
1:pro表
2:attr表
3:attr2pro表
先要查 内圈 为 15 外圈为 20 产品关键词为 齿轮 的 所有产品
一句话sql 怎么写呢
本人对sql有待进一步学习。求指点。。
注:mysql
sql mysql 关联查询 分享到:
------解决方案--------------------
select *
from pro,
(select * from attr2pro where attr_id=1 and value=15) t1,
(select * from attr2pro where attr_id=2 and value=20) t2
where pro.pro_id=t1.pro_id and pro.pro_id=t2.pro_id