查询的SQL语句
TB1 TB2
ID Pic FID | ID Title Content About
1 * 1 | 1 * * *
2 * 1 | 2 * * *
3 * 2 | 3 * * *
4 * 2 | 4 * * *
5 * 2 |
6 * 3 |
7 * 4 |
查询表2的前三条记录,和应表1的记录(多个记录返回一个)
------解决方案--------------------select * from tba
left join tbb on tba.id=tbb.id
where id in (select distinct id from tba )
------解决方案--------------------两个表的关系?貌似TB1.FID 和 TB2.ID关联
------解决方案--------------------select * from tb2
left join (select FID from tb1 group by FID) t1 on t1.Fid=tb2.id