日期:2014-05-17  浏览次数:20472 次

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