I am trying to modify a PL/SQL query that pulls a distinct list for a ColdFusion dropdown, which in turn runs a query for a filter based on what was chosen in the dropdown. The problem is, the distinct list has multiple entries as there are a couple of entries that map to 2 different short descriptions.
Here is an example of my query:
SELECT DISTINCT O.LONG_DESCR, O.OPTION_ID,O.SHORT_DESCR
FROM OPTION O
JOIN GROUP G ON o.GROUP_ID = G.GROUP_ID
WHERE O.SHORT_DESCR IN ('A','B','C','D','E','F')
ORDER BY O.LONG_DESCR
I do not need to join to GROUP in this query, but that is what they had in the previous query I need to update. What happens is when this is ran, it shows an output of something similar to this:
Agent 1 1 'A'
Agent 1 3 'C'
Agent 2 2 'B'
Agent 3 4 'D'
Agent 3 6 'F'
Agent 4 5 'E'
Notice that short description A and C have the same Long Description and short description D and F have the same long description.
The dropdown only looks at long description and outputs
Agent 1
Agent 1
Agent 2
Agent 3
Agent 3
Agent 4
We need the dropdown to just have Agent 1, 2, 3, and 4 and no duplicates but if they choose, for instance, agent 1 then the query will filter out to just anything with Short Description of 'A' and 'C'.
Maybe I should be thinking about how to do it in ColdFusion but I am not too familiar with that, yet. Any help is appreciated!