select * from 表1,表2 where 表1.关联字段=表2.关联字段 and 表2.主键 in(select min(主键) from 表2 group by 关联)
使用sql语句获取一对多中的第一条记录
最新推荐文章于 2024-04-30 09:23:45 发布
select * from 表1,表2 where 表1.关联字段=表2.关联字段 and 表2.主键 in(select min(主键) from 表2 group by 关联)