Home » Performance » MySQL » Selecting Items for Child Categories?
Selecting Items for Child Categories? [message #928] Wed, 14 March 2007 13:28
sjaguar13  is currently offline sjaguar13
Messages: 1
Registered: March 2007
Junior Member
I have a links system that has categories. Each category either has links or more categories. I need to randomly get 5 links to display in the main content area, if the category only contains more categories. The problem is I only want random links from the categories below the current category.

If I have:
-News
--USA
---New York
---California
--Canada
-Music
--Rock
---AC/DC
----Back In Black

For news, I could have any link in New York, California, or Canada. USA wouldn't have any links as all those would have to either be in New York or California. Another issue is the depth isn't always known. For news, 1 and 2 levels down contain links. For music, the 3rd level contains the links. Is there a way to get random links from only the categories below? Is there a better way to set up the table?
Previous Topic:Need help to understand select_scan
Next Topic:INDEX on DATETIME column
Goto Forum:
  


Current Time: Fri Jul 10 02:30:51 EDT 2009

Total time taken to generate the page: 0.08843 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 2.7.7.
Copyright ©2001-2007 FUD Forum Bulletin Board Software

MySQL is a trademark of Sun Microsystems.
InnoDB is a trademark of Oracle Corp.

Percona Performance Forums are a service of Percona, Inc.
Not affiliated with Sun Microsystems or Oracle Corp.