I have three tables. One contains main menu items, one contains sub menu items and one contains the link between main menu and sub menu items.
Since more than one main menu item can have the same sub menu item I can't contain the sub menu item's parent in the sub menu table.
I want to list the ID numbers of the sub menu items in the table but only once but it needs to be ordered by the rank of the main menu items followed by their rank.
The statement I'm using is:
The results should be:
57
58
12
25
28
9
24
22
30
The results that come up are:
57
58
12
25
9
24
22
28
30
For some reason 28 is being moved down. Is it missing out it's instances before that time becuase it occure three times before?
Any ideas?
Since more than one main menu item can have the same sub menu item I can't contain the sub menu item's parent in the sub menu table.
I want to list the ID numbers of the sub menu items in the table but only once but it needs to be ordered by the rank of the main menu items followed by their rank.
The statement I'm using is:
Code:
SELECT DISTINCT Tiein.subMenuId FROM Tiein, MainMenu, SubMenu WHERE Tiein.mainMenuId=MainMenu.mainMenuId && Tiein.subMenuId=SubMenu.subMenuId ORDER BY MainMenu.rank, Tiein.rank;
57
58
12
25
28
9
24
22
30
The results that come up are:
57
58
12
25
9
24
22
28
30
For some reason 28 is being moved down. Is it missing out it's instances before that time becuase it occure three times before?
Any ideas?
Comment