首頁 >後端開發 >php教程 >循环有关问题--HELP

循环有关问题--HELP

WBOY
WBOY原創
2016-06-13 10:03:071088瀏覽

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