Jump to content


Photo

Fixed Records From Random Category


  • Please log in to reply
3 replies to this topic

#1 triphp

triphp
  • Members
  • Pip
  • Newbie
  • 7 posts
  • LocationCebu, Philippines

Posted 15 September 2005 - 10:38 AM

I'm not very well taught on MySQL so i have this problem coming in. I have three tables, lets say, parent and child.

PARENT
parentid
parentname

CHILD
childid
parentid
childname

CHILDINFO
childid
bigbiohere
anothercolumnhereformisc_info_and_so_on

My Problem:
I want to select one random parent and then list its child at least 5 child with the bio description. Is this possible?
Please help me out.

THANKS!
http://www.spokendollars.com/- Let's talk how to earn money online.

#2 czambran

czambran
  • Staff Alumni
  • Advanced Member
  • 52 posts
  • LocationFairfield,IA

Posted 15 September 2005 - 07:27 PM

Why not take child and childinfo tables and merge into one? What of version of mysql are u using? If u r using mysql 4.1 or higher you can use subqueries otherwise I think u will have to do 2 queries.
Chris
Using undefined variables in PHP is not an error, just sloppy coding practice. PHP5 Power Programming BOOK
--------------------------------------------------------------------------
PHP F.A.Q.
Linux User #394154

#3 triphp

triphp
  • Members
  • Pip
  • Newbie
  • 7 posts
  • LocationCebu, Philippines

Posted 16 September 2005 - 05:24 AM

Hmmm, that was just an example but the actual database design can't be made into what you have suggested. No question about the actual design, it's correctly implemented.

How to do the subqueries for that one? Two queries must not be done due to the kind of software I'm modifying.
http://www.spokendollars.com/- Let's talk how to earn money online.

#4 triphp

triphp
  • Members
  • Pip
  • Newbie
  • 7 posts
  • LocationCebu, Philippines

Posted 19 September 2005 - 05:52 AM

BUMP*
http://www.spokendollars.com/- Let's talk how to earn money online.




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users