I have a mySQL table with a town_id and 3 categories - cat1, cat2, cat3.
I need to be able to come up with a distinct list of all the categories in the table selected by town_id, not duplicated and in alphabetical order.
Thanks!
|
I have a mySQL table with a town_id and 3 categories - cat1, cat2, cat3. I need to be able to come up with a distinct list of all the categories in the table selected by town_id, not duplicated and in alphabetical order. Thanks! |
|||
|
|
|
If I understood the question right, you need something like
[id_value] - chosen town_id. UNION by default is distinct; result of union as far as I remember will be sorted automatically in most implementations, but you may add Taking the OP's comment context:
|
|||||||||||
|