SELECT a.Name,b.Name,c.Name FROM your_table a LEFT OUTER JOIN your_table
b
ON a.Code=b.ParentFemale LEFT OUTER JOIN your_table c
ON a.Code=c.ParentMale

> -----Original Message-----
> From: Fam. Tarniceru [mailto:[EMAIL PROTECTED]] 
> Sent: Friday, December 13, 2002 3:39 PM
> To: MySQL Mailing List
> Subject: a simple query
> 
> 
> Hi,
> 
> I have a table like this:
> 
> -----------------------------------------------
> | Code | Name   | ParentFemale | ParentMale  |
> -----------------------------------------------
> |        1 | Child    |                 2   |                 3  |
> -----------------------------------------------
> |        2 | Mather |                 0   |                 0  |
> -----------------------------------------------
> |        3 | Father  |                 0   |                 0  |
> -----------------------------------------------
> 
> and I need a query to obtain this table:
> 
> --------------------------------------
> | Name | ParentFemale | ParentMale |
> --------------------------------------
> |  Child |     Mather       |      Father    |
> --------------------------------------
> 
> and if in I have the next values in table 1
> 
> -----------------------------------------------
> | Code | Name   | ParentFemale | ParentMale  |
> -----------------------------------------------
> |        1 | Child    |                 0   |                 0  |
> -----------------------------------------------
> |        2 | Mather |                 0   |                 0  |
> -----------------------------------------------
> |        3 | Father  |                 0   |                 0  |
> -----------------------------------------------
> 
> I need the next values for table 2:
> 
> --------------------------------------
> | Name | ParentFemale | ParentMale |
> --------------------------------------
> |  Child |     Null            |      Null       |
> --------------------------------------
> 
> Can you help me, please?
> 
> Sincerely,
> 
> Adrian
> 
> 
> 
> 
> -------------------------------------------------------
> Xnet scaneaza automat toate mesajele impotriva virusilor 
> folosind RAV AntiVirus. Xnet automatically scans all messages 
> for viruses using RAV AntiVirus.
> 
> 
> Nota: RAV AntiVirus poate sa nu detecteze toti virusii noi 
> sau toate variantele lor. Va rugam sa luati in considerare ca 
> exista un risc de fiecare data cand deschideti fisiere 
> atasate si ca MobiFon nu este responsabila pentru nici un 
> prejudiciu cauzat de virusi.
> 
> Disclaimer: RAV AntiVirus may not be able to detect all new 
> viruses and variants. Please be aware that there is a risk 
> involved whenever opening e-mail attachments to your computer 
> and that MobiFon is not responsible for any damages caused by viruses.
> 
> 
> ---------------------------------------------------------------------
> Before posting, please check:
>    http://www.mysql.com/manual.php   (the manual)
>    http://lists.mysql.com/           (the list archive)
> 
> To request this thread, e-mail <[EMAIL PROTECTED]>
> To unsubscribe, e-mail 
> <[EMAIL PROTECTED]>
> Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php
> 
> 
> 
> 


---------------------------------------------------------------------
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/           (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

Reply via email to