sql - How to do nested sorting within dense_rank -
I used the dense rank to group items in the table in a 3-day bucket. Example: April 22-24 will be 'tight' together and will be handed over to priority 4.
Question:
- I need to do more sorting on plan_package based on QTYORDERED. I have the last result given below for priority 4
I use SQL as the sorting below. Anybody can help on the schematic package and sorting ??? ** **
Select SALESORDERID, ITEM, PLANNING_PACKAGE, GENERIC_PACKAGE, QTYORDERED, DMD_TYPE_CD, ORDER_TYPE_CD, PRIORITY_NBR, PROMISEDAVAILDATE, dense_rank () over (sequence by round ((when case dmd_type_cd = 'Netted Forecasting 'is the biggest (ProAcAdAVATAAT, (DADT ('22-AP-14', 'DD-MN-YY') + 31) and ends the gap of futures - (to_date ('22 -Apr-14 ',' DD-MON-YY ') + 1)) / 3, 0) TEST_SALESORDER_TABLE as priority;
You can specify multiple columns to sort by order in the
section - In your case this will be done ....
order from priority, qtyordered desc
if
priority is an expression, which you Ordering column positions as well
Comments
Post a Comment