Cascading a MySQL SELECT
November 12, 2007 9:55 AM
Subscribe
I'm determined to do this in one query. I sure I can, I KNOW you can.
Writing a tooltip retrieval system for a site with multiple versions of the same module. I want to supply a generic tip for each version level that can be overridden for a specific module. Diagrams = word x 10^3
So the Knowledgebase table looks a bit like this
| Path | Item | Tooltip |
| Articles | add | Generic tip text |
| Articles-1.0 | add | Fall back for all 1.0 |
| Articles-1.0.2 | add | Specific for 1.0.2 |
| Articles-1.0.3 | add | Specific for 1.0.3 |
So for I've tried SELECTING with GROUP BY, with DISTINCT, with ORDER BY and results have been inconsistent. When I get a sucess I'm never confident its not a fluke
I simply want to make the call with the module's path and for it to nicely degrade back to the root if nothing else exists. So that
getTip(Articles-1.0.2) returns "Specific for 1.0.2"
getTip(Articles-1.0.4) returns "Fallback for all 1.0"
getTip(Articles-2.0.0) returns "Generic tip text"
Hmm - committing it here makes me think its not a single request after all, but this is how translations engines work isn't it (if theres no translation have a fallback language?)
Hope that makes sense
posted by handybitesize to computers & internet (9 comments total)
posted by handybitesize at 10:00 AM on November 12, 2007