I’m trying without success to solve this tricky point.
I have a mysql table like the following:
Category Model Description
cat1 AAA Triple A
cat1/cat2 AAA Triple A
cat1/cat2 BBB Triple B
cat1 BBB Triple B
cat3 CCC Triple C
cat3/cat4/cat5 CCC Triple C
cat3/cat4 CCC Triple C
etc.
I would like to select rows with unique Model and “longest” Category. Basically I would like to obtain:
Category Model Description
cat1/cat2 AAA Triple A
cat1/cat2 BBB Triple B
cat3/cat4/cat5 CCC Triple C
Any hint?
You may in fact, want the deepest category rather than longest. If this is the case, there are better options than above.