Re: Showing Mixed Results From Two Tables w/ Diff Num of Cols
Posted by:
mike ix
Date: September 05, 2006 11:48AM
Yes, I've looked very carefully at JOINS, and I understand enough to know that there are MANY methods of using a JOIN to do the aforementioned task. I'm looking for the best way. Currently, using my previous example, my tables might look something like this:
[ oranges ]
# ID # Size # Weight # Orchard Location
[ cars ]
# ID # Make # Model # Size # Color # Year # VIN # License
[ puppies ]
# ID # Gender # Age # Breed
[ ratings ]
# ID # Total Rating # Base Rating # Day 1 # Day 2 # Day 3
Every orange, car and puppy's ID is listed in the rating table with their ratings. I want to display the results of all the highest rated items, but I don't necessarily want the results joined together. In other words the results should look like this:
1. Rating: 1500, ID: 307, Size: medium, Weight: 5.8 oz. etc...
2. Rating: 1200, ID: 854, Gender: boy, Age: 0.5 years, Breed: bloodhound
3. Rating: 1100, ID: 114, Gender: girl, Age: 1.0 years, Breed: german shepard
4. Rating: 1000, ID: 233, Make: Toyota, Model: Tercel, etc...
5. Rating: 900, ID: 35, Size: large, etc...
If I were to join these results then all the properties of each item would be listed together on the same line. I hope this helps explain my situation a little better.
So far, the only method I can think or know to do is to make one querry to the rating table and load an array with the IDs (sorted of course), then make a seperate call for each ID to it's appropriate table. This seems quite cumbersome though, to make so many calls. Is there a way to do what I'm asking in one call?