I only have experience using pretty basic Oracle. However, I'm now in need of a better understanding of SQL. I'm trying to write a query using CASE statements (as this seems to be the best approach), but am admittedly lost at the moment.
Here is what I have as a basis:
SELECT LEFT(ITEM_A, 4) AS "PREFIX", SUBSTRING(RIGHT(ITEM_A, 12), 5, 2) AS "SUFFIX", RIGHT(ITEM_A, 16) AS "INGREDIENT" FROM THE_TABLE WHERE ITEM_B = 'VAL1' AND ITEM_C = 'VAL2' GROUP BY ITEM_A ORDER BY PREFIX ASC, SUFFIX ASC
This is yielding a good result set for evaluation. Now, I need to determine which (if any) 'INGREDIENT' values are associated to multiple 'PREFIX' & 'SUFFIX' combos and what those combos are if present. I'm really hitting a brick wall here.