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:

enter image description here

i wish have sql output 'group' records activity!=d. output results need table below:

enter image description here

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

Popular posts from this blog

css - SVG using textPath a symbol not rendering in Firefox -

Java 8 + Maven Javadoc plugin: Error fetching URL -

order - Notification for user in user account opencart -