SQL语句select * from 表名 group by 列名--不是 GROUP BY 表达式RTselect * from 表名 group by 列名----- 报错 ORA-00979:不是 GROUP BY 表达式数据库:oracle10g* 换成 列名也不行

来源:学生作业帮助网 编辑:作业帮 时间:2024/04/20 10:28:59
SQL语句select * from 表名 group by 列名--不是 GROUP BY 表达式RTselect * from 表名 group by 列名----- 报错 ORA-00979:不是 GROUP BY 表达式数据库:oracle10g* 换成 列名也不行

SQL语句select * from 表名 group by 列名--不是 GROUP BY 表达式RTselect * from 表名 group by 列名----- 报错 ORA-00979:不是 GROUP BY 表达式数据库:oracle10g* 换成 列名也不行
SQL语句select * from 表名 group by 列名--不是 GROUP BY 表达式
RT
select * from 表名 group by 列名----- 报错 ORA-00979:不是 GROUP BY 表达式
数据库:oracle10g
* 换成 列名也不行

SQL语句select * from 表名 group by 列名--不是 GROUP BY 表达式RTselect * from 表名 group by 列名----- 报错 ORA-00979:不是 GROUP BY 表达式数据库:oracle10g* 换成 列名也不行
group by 的意思为分组汇总.
使用了group by 后,要求Select出的结果字段都是可汇总的,否则就会出错.
比如,有:{学号,姓名,性别,年龄,成绩}字段
这样写:
SELECT 学号,姓名,性别,年龄,sum(成绩)
FROM 学生表
GROUP BY 学号
就是错的,因为 “姓名、性别、年龄”未被汇总,且不一定是单一.
这样写:
SELECT MAX(学号),MAX(姓名),MAX(性别),MAX(年龄),sum(成绩)
FROM 学生表
GROUP BY 学号
是对的,汇总出每一同学号学生的总成绩.注意的是,只要学号相同,别的如果有不同,取它们值最大的一条作为显示输出.
这样写:
SELECT 学号,姓名,性别,年龄,sum(成绩)
FROM 学生表
GROUP BY 学号,姓名,性别,年龄
这样写也是对的,但注意的是,学号,姓名,性别,年龄中,只要有一个不同,就会当成另一条记录来汇总.
以上仅记忆,可能有错,自个去理解测试,说错请原谅,我也是在学习中.

SQL 语句 SELECT * FROM {{table}} WHERE `fleet_end_time` sql语句 后面的(+) select * from t1,t2 where t1.a=t2.b(+) oracle sql语句获取前两条数据select id,seq from hzds_admin where seq sql语句中!例如SELECT STUDENT.学号,student.姓名from sdb!student SQL语句:SELECT * from stu where name like %伟%;的作用是:_________________________. select ename from emp where ename like'%A___'; 这条SQL语句中'%A___'是什么意思? 这句SQL语句是什么意思.ql=select distinct(selabel) from.sql=select distinct(selabel) from kcwl_labprosellog where isdel=0 &sqlfile& and selabel not in (select distinct(selabel) from kcwl_labprosell) 这个语句是什么作用的.说具 select id,name from student where id in ( select id from score having count(id)>=2 );以上这段语句有没语法错误.SQL语句 求单表查询的hql语句怎么写sqL如下:select * from aaa20 where aaae2001 = '11111111';求hql语句写法 求高人sql语句!select state from 表 order by 怎样让state=2,state=6,state=8的数据拍到最前 SQL语句理解 select * from B where (select count(1) as num from A where A.ID = B.ID) = 0select * from B where (select count(1) as num from A where A.ID = B.ID) = 0请问如何理解,为什么 可以在B表中 排除A表的数据 select id from (select * from tree)这个sql语句有什么错吗提示:Every derived table must have its own aliasmysql数据库 sql语句中加中括号和不加有什么区别吗?比如:SELECT title FROM authors和SELECT [title] FROM [authors]这两个有区别吗? 大侠这个查询语句的意思是什么?sql=select DISTINCT 日期 from +tablename+ where 日期>=' +df +' and 日期 sql 语句中 select * from table where 2=1 的where2=1有什么意思和作用 select * from customers where CompanyName like '+TextBox1.Text+' ,如上sql语句.请问'+TextBox1.Text+'到底应用的什么语法. sql语句:去掉最大值,去掉最小值,算平均值SELECT AVG(Scores.Score)FROM ScoresWHERE ( ( (Scores.[ID]) = @id)AND (Score < (SELECT MAX(Score) From Scores WHERE Scores.[ID] = @id) )AND (Score > (SELECT MIN(Score) From Scores WHERE Scores.[I select count(*) from table1 select count(*) from table2 select count(*) from table3我从table1 table2 table3 中 找数据的条数怎样一下子用一条sql语句 算出TABLE1 TABLE2 TABLE3 记录的总和?