oracle11g - SQL to 'group' certain records -
i not entirely sure if possible in sql (i no means expert).
i have lines of data in tablea below:
i wish have sql output 'group' records activity!=d. output results need table below:
any 'merged' activities would grouped 'merged'. in example, , b.
i got started
select cycle_start, cycle_end, activity_start, activity_end, case when (activity="d") "d" else "merged" end
but struggle aggregation correct
yes, can case
in group by
:
select cycle_start, cycle_end, min(activity_start) activity_start, max(activity_end) activity_end, (case when activity = 'd' 'd' else 'merged' end) table t group cycle_start, cycle_end, (case when activity = 'd' 'd' else 'merged' end)
Comments
Post a Comment