Hi,
Does anyone know why my order by is not working correctly, before I had an oracle error using distinct in my select statement, so i had to remove the order by, but the SQL is working fine for this query now, and all my data is correct. Just my order by is incorrect.
SELECT distinct I.SKU_ID, I.LOCATION_ID, TO_CHAR(I.EXPIRY_DSTAMP, 'DD-Mon-YYYY'), to_char(trunc(I.EXPIRY_DSTAMP) - trunc(S.SHIP_SHELF_LIFE), 'DD-Mon-YYYY'), S.SHIP_SHELF_LIFE
FROM INVENTORY I, SKU S
WHERE I.EXPIRY_DSTAMP - S.SHIP_SHELF_LIFE < SYSDATE + $P{days}
AND S.SKU_ID = I.SKU_ID
order by TO_CHAR(I.EXPIRY_DSTAMP, 'DD-Mon-YYYY') asc
Regards,
SM.