Could be a quickie
| 3:11 pm on Jan 30, 2008 (gmt 0)|
Just a quick one, I have two cols: Hierarchy, IdHierarchy
Hierarchy is like 1,2,3,...,n that's relative to IdHierarchy that's like 1.2.3, 1.2.4, 1.2.5, 1.2.n
I've like MySQL to sort my query by IdHierarchy first and then order by Hierarchy for each group (in a sense).
| 5:15 pm on Jan 30, 2008 (gmt 0)|
Does mysql support left()?
ORDER BY left(heriechyID,1), heirarchy
| 5:25 pm on Jan 30, 2008 (gmt 0)|
|ORDER BY left(heriechyID,1), heirarchy |
But ordering by just the first character won't guarantee that 1.2.3 will come before 1.2.4.
I'm not quite sure of what the OP means. Can you post a short example of what you'd like the sorted data to look like?
| 7:06 pm on Jan 30, 2008 (gmt 0)|
I decided to restructure the database and changed a few things. It's all working now. I now have ParentHierarchy (n.n.n ...), Hierarchy (n.n.n ...) and IdHierarchy (id.id.id ...). This allows me to ORDER BY Hierarchy (because that's an absolute hierarchy where before was relative to the level as defined in IdHierarchy).
| 7:08 pm on Jan 30, 2008 (gmt 0)|
Yea, I'm afraid I don't get it either. Just what is it that you are trying to do? I think you need to back-up a bit and tell us what you are trying to accomplish.
(Oops, we crossed posts.)