22,209
社区成员
发帖
与我相关
我的任务
分享
--A 表:
LoginName Name Address
test1 test1 北京
test2 test2 上海
test3 test3 广州
test4 test4 重庆
--b 表:
LoginName ord1 ord2 ord3
test1 ord1_abc ord2_abc ord3_abc
test2 ord4_def ord5_def ord6_def
select a.LoginName,a.Name,a.Address,(select len(ord1+ord2+ord3) from b where b.LoginName=a.LoginName) as lenOrd
from a
order by lenOrd
select a.* from A表 a,B表 b
where a.LoginName=b.LoginName order by b.ord1,b.ord2,b.ord3