首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 数据库 > oracle >

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

2012-09-22 
group by查询问题,要列出不再group by后面的统计字段A表AID AText1 AText2 AText3...AText911121319121222

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;
[解决办法]
意思没明白。

热点排行