Home  >  Article  >  Backend Development  >  循环有关问题--HELP

循环有关问题--HELP

WBOY
WBOYOriginal
2016-06-13 10:03:071052browse

循环问题--HELP
求教:
表1:
db_1

fid
fup
name
---------------
表2:
db2

fid
subject
---------------
fid(表db_1)=fid(表db_2)
--------------------------------
我是想循环列出表1中 fup=0 的name以及跟name相关的subject。


————————————————————————
|
| name1 | name2 | name3 | name4
|subject subject subject subject
|subject subject subject subject
|subject subject subject subject
|subject subject subject subject
|subject subject subject subject
|subject subject subject subject
|

------解决方案--------------------
select db_1.name,db_2.subject from db_1,db_2 where db_1.fid=db_2.fid and db_1.fup=0 
 group by db_1.name,db_2.subject

Statement:
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