Trying to get a return of lowest # based on 2 fields. This returns the wrong amount of 3 when 2 need 2 in the check field.
This is my original code that runs but returns the wrong amount.
SUM(CASE WHEN depth=pallets then depth else to_char(pallets) end) AS "CHECK"
WHERE facility IN ('XXX4')
GROUP BY location,unitofstorage,depth
ORDER BY location
This is the result. CHECK should be 2.
Somebody said to try this.... But getting the ORA-00933: SQL command not properly ended. I suspect it is something simple but I have not found anything to help as of yet. I simplified this version.
CASE WHEN a.pallets<=a.depth then to_char(a.pallets) else a.depth end AS "CHECK"
WHERE (facility IN ('xxx4')
ORA-00933: SQL command not properly ended 00933. 00000 - "SQL command not properly ended" *Cause:
*Action: Error at Line: 1 Column: 354