I have a page that that lists products returned from a mysql query. The query can very greatly depending on many different things.
What I want to do is give the user an option to narrow the current results by series of drop-downs. For example to narrow the product type. But to get the available product types I am currently just checking for distinct values for the product types from the data-base. This is not ideal because if a particular product type is not in any of the current results it will then show no results. So basically I just want to select the distinct values from the current query results and not from the entire data-base.
Is there a way I can do that once the query is already made?
I am looking for something along the lines of:
SELECT DISTINCT product_field FROM (my_other_query)
Thanks!!