当前位置: 代码迷 >> Oracle管理 >> group by查询有关问题,要列出不再group by后面的统计字段
  详细解决方案

group by查询有关问题,要列出不再group by后面的统计字段

热度:61   发布时间:2016-04-24 05:08:17.0
group by查询问题,要列出不再group by后面的统计字段
A表

AID AText1 AText2 AText3... AText9 
1 11 21 31 91
2 12 22 32 92
3 13 23 33 93


B表

BID BText1 BText2
1 11 100
2 11 200
3 12 300
4 12 400
5 13 500
6 13 600

C表 结果需要join的表

结果

AText1 AText2 ... AText9 BText2 CText1
11 21 91 300
12 22 92 700
13 23 93 1100

我是用Group BY 怎么样把AText2-AText9的列列出来,并且和C表的数据join连接

------解决方案--------------------
SQL code
--A,B表,你C表什麼結構select A.*,t.BText2from Aleft join (select BText1,sum(BText2) BText2 from B group by BText1) ton A.AText1=t.BText1;
------解决方案--------------------
意思没明白。
  相关解决方案