Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Conditional GROUP BY

User_W65WSNov 5 2016 — edited Nov 7 2016

Hi All,

My data is given as below:

Table Name: TripDetails

Tripnum               Zone        ShipDate                      Item

123                      AB0         14-OCT-2016              Item 1

123                      AB0          14-OCT-2016              Item 2

124                      AB1          14-OCT-2016              Item2                    

NULL                  AB2           14-OCT-2016              Item3

NULL                  NULL         14-OCT-2016              Item4

Now my requirement is I want to GROUP BY Tripnum if TRIPNM is NOT NULL. If TripNUM is NULL THEN GROUP BY ZONE but excluding NULL ZON. If TRIPNUM and ZONE both are NULL THEN GROUP BY SHIPDATE.

Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Dec 5 2016
Added on Nov 5 2016
19 comments
4,378 views