Hi,
I have a simple problem that I don't know how to solve with mysql.
I have 2 tables, a parent table and a child table.

parent:
-------------------
| p_id  |   name  |
-------------------
|  1    |     A   |
|  2    |     B   |
|  ...  |    ...  |
|  112  |     C   |
|  113  |     D   |
-------------------
child:
----------------------------------
| c_id  |  p_id  |  name |  age  |
----------------------------------
|  1    |    1   |  BP   |  15   |
|  2    |    56  |  AW   |  12   |
|  ...  |   ...  |  GH   |  19   |
|2999999|    2   |  RT   |  14   |
|3000000|    56  |  FG   |  18   |
----------------------------------

I want to get a list of all the parents with the age and the name of the older 
child they've got. Let's say that a parent can't have 2 children with the same 
age.
I can solve my problem by using multiple queries but that's not very clean and a 
bit heavy (especially if there are lots of parents).

Any idea?

Thank you
Benjamin

-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]

Reply via email to