Home > database >  Oracle at the same time using the order by and group by is not a set of expressions
Oracle at the same time using the order by and group by is not a set of expressions

Time:09-26

SELECT
*
The FROM
(
SELECT
Row_. *, ROWNUM rownum_
The FROM
(
SELECT
Edv. CLASS_CODE virtualClassCode,
Edv. CLASS_NAME virtualClassName,
Edv. MASTER_TEACHER_EMAIL masterEmail,
Edv. MASTER_TEACHER_NAME masterName,
Edv. SUBJECT_NAME subjectName,
TO_CHAR (
Edv. The START_DATE,
'- DD YYYY - MM'
) the startDate,
TO_CHAR (edv), END_DATE '- DD YYYY - MM), endDate
Edv. LESSON_TIME lessonTime,
Edv. LESSON_COUNT lessonCount,
TO_CHAR (
Edv CREATE_TIME,
'- DD YYYY - MM HH24: MI: SS'
CreateTime,
Edv. CREATE_BY creatorId,
Edv. ID vId,
Edv. CREATOR_NAME creatorName,
Edv. MODIFY_ID modifyId,
Edv. MODIFY_NAME modifyName,
Edv. IS_ONLINE isOnLine,
TO_CHAR (
Edv MODIFY_TIME,
'- DD YYYY - MM HH24: MI: SS'
) modifyTime
The FROM
EXT_DT_VIRTUAL_CLASS edv
LEFT the JOIN EXT_DT_VIRTUAL_BIND_REAL_CLASS BC ON EDV. "ID=" BC. VIRTUAL_CLASS_ID
LEFT the JOIN EXT_DT_VIRTUAL_LESSON edl ON EDV. "ID=" edl. VIRTUAL_CLASS_ID
WHERE
1=1
GROUP BY edv. "ID", edv, CREATE_TIME
The ORDER BY
Edv. CREATE_TIME DESC

) row_
WHERE

ROWNUM & lt;=10
)
WHERE
Rownum_ & gt; 0



Quote: [Err] ORA - 00979: not a GROUP BY expression

CodePudding user response:

No aggregation function does not need to use group by, try to use, is group by all fields.
Changed the SQL, you perform the try it:
 
Select *
The from (select t. *, rownum rn
The from (select edv. Class_code virtualclasscode,
Edv. Class_name virtualclassname,
Edv. Master_teacher_email masteremail,
Edv. Master_teacher_name mastername,
Edv. Subject_name subjectname,
To_char (edv) the start_date, 'yyyy - mm - dd) startdate,
To_char (edv), end_date '- dd yyyy - mm), enddate
Edv. Lesson_time lessontime,
Edv. Lesson_count lessoncount,
To_char (edv create_time, 'yyyy - mm - dd hh24: mi: ss'), createtime
Edv. Create_by creatorid,
Edv. Id vid,
Edv. Creator_name creatorname,
Edv. Modify_id modifyid,
Edv. Modify_name modifyname,
Edv. Is_online isonline,
To_char (edv modify_time, 'yyyy - mm - dd hh24: mi: ss') modifytime
The from ext_dt_virtual_class edv
Left the join ext_dt_virtual_bind_real_class BC on edv. Id=BC. Virtual_class_id
Left the join ext_dt_virtual_lesson edl on edv. Id=edl. Virtual_class_id
The order by edv. Create_time desc
) t
Where rownum & lt;=10
)
Where an rn & gt; 0

CodePudding user response:

Edv. Id vid with Spaces between, need to change to: edv. Id vid
  • Related