表A
字段a1 a2
--------------
表B
字段
b1 b2
----------
A.a1和B.b1是主外键,我想获得a1,a2,b1,b2四个字段,想把结果按B.b2来分组,然后同一组内的数据按A.a2来排序。该怎么写这句SQL
------解决方案--------------------
- SQL code
select * from a,b where a.a1=b.b1 order by b.b2,a.a2
select * from a,b where a.a1=b.b1 order by b.b2,a.a2