首页  >  文章  >  后端开发  >  循环有关问题--HELP

循环有关问题--HELP

WBOY
WBOY原创
2016-06-13 10:03:071053浏览

循环问题--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

声明:
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系admin@php.cn