Home > Backend Development > PHP Tutorial > 一个SQL关联查询的问题。求解

一个SQL关联查询的问题。求解

WBOY
Release: 2016-06-23 14:27:05
Original
897 people have browsed it

sql mysql 关联查询

目前有三张表

1:PRO表


2:ATTR表



3:ATTR2pro表



先要查  内圈 为 15  外圈为 20  产品关键词为  齿轮 的 所有产品 

一句话SQL 怎么写呢

本人对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
Copy after login

楼上正解。感谢

source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template