sql - ORA-00979 not a group by expression -
i getting ora-00979 following query:
select cr.review_sk, cr.cs_sk, cr.full_name, tolist(to_char(cf.fact_date, 'mm/dd/yyyy')) "appt", cs.cs_id, cr.tracking_number review cr, cs, fact cf cr.cs_sk = cs.cs_sk , upper(cs.cs_id) '%' || upper(i_cs_id) || '%' , row_delete_date_time null , cr.review_sk = cf.review_wk (+) , cr.fact_type_code (+) = 183050 group cr.review_sk, cr.cs_sk, cf.fact_date, cr.tracking_number order cs.cs_id, cr.full_name;
i couldn't find examples had both group , order clauses in same query. tried removing each field group 1 @ time, still getting same error.
you must put columns of select
in group by
or use functions on them compress results single value (like min
, max
or sum
).
a simple example understand why happens: imagine have database this:
foo bar 0 0 b
and run select * table group foo
. means database must return single row result first column 0
fulfill group by
there 2 values of bar
chose from. result expect - a
or b
? or should database return more 1 row, violating contract of group by
?
Comments
Post a Comment