9 个解决方案
#1
两表没有关系吗?
#2
-- 一个表跟另一个表是怎么关联的撒?
#3
把两个表的结构,数据和你想要的结果贴出来
#4
select a.* , b.* from a , b where a.id = b.id order by b.某字段
#5
select a.* from a,b where a.id=b.id order by b.字段
#6
select a.* from a join b on a.id=b.id order by b.id
#7
1對1關聯時
直接 inner join 連接 + order by
1對多時
order by (select top 1 COl1 from T2 where ID=t1.ID)
直接 inner join 連接 + order by
1對多時
order by (select top 1 COl1 from T2 where ID=t1.ID)
#8
两表之间应该有个关联字段吧?
比如 关联字段: ID
select A.*
from A
left join A.ID = B.ID
order by B.排序字段
#9
join兩個表,然后按另一個表中的字段order by 就可以了
#1
两表没有关系吗?
#2
-- 一个表跟另一个表是怎么关联的撒?
#3
把两个表的结构,数据和你想要的结果贴出来
#4
select a.* , b.* from a , b where a.id = b.id order by b.某字段
#5
select a.* from a,b where a.id=b.id order by b.字段
#6
select a.* from a join b on a.id=b.id order by b.id
#7
1對1關聯時
直接 inner join 連接 + order by
1對多時
order by (select top 1 COl1 from T2 where ID=t1.ID)
直接 inner join 連接 + order by
1對多時
order by (select top 1 COl1 from T2 where ID=t1.ID)
#8
两表之间应该有个关联字段吧?
比如 关联字段: ID
select A.*
from A
left join A.ID = B.ID
order by B.排序字段
#9
join兩個表,然后按另一個表中的字段order by 就可以了