Showing posts with label gender. Show all posts
Showing posts with label gender. Show all posts

Wednesday, March 21, 2012

Is this doable?

Hi,
Can you tell me if something like this is doable? Assume I have 2 tables as
follows:
Member(ID, Name, Gender)
Children(ID, FatherID, MotherID)
where ID, FatherID, MotherID are integers, Name is a character.
Assuming that I have the member's ID to start with, would it be possible to
display a row with the following:
ID, Name, [Father's Name], [Mother's Name] ?
Thank you
Please post onlySELECT M1.ID, M1.Name,
M2.Name as [Father's Name], M3.Name as [Mother's Name]
FROM Member M1
INNER JOIN Children C ON M1.ID=C.ID
INNER JOIN Member M2 ON C.FatherID=M2.ID
INNER JOIN Member M3 ON C.MotherID=M3.ID
Razvan|||Xref: TK2MSFTNGP08.phx.gbl microsoft.public.sqlserver.programming:511725
No. I get the same name twice (the member's name is the same as the father)
Thank you
Please post only
"Razvan Socol" <rsocol@.gmail.com> wrote in message
news:1110348053.094178.253040@.f14g2000cwb.googlegroups.com...
> SELECT M1.ID, M1.Name,
> M2.Name as [Father's Name], M3.Name as [Mother's Name]
> FROM Member M1
> INNER JOIN Children C ON M1.ID=C.ID
> INNER JOIN Member M2 ON C.FatherID=M2.ID
> INNER JOIN Member M3 ON C.MotherID=M3.ID
> Razvan
>|||Xref: TK2MSFTNGP08.phx.gbl microsoft.public.sqlserver.programming:511727
Oops... sorry my mistake. Thank you very much.
Thank you
Please post only
"!!bogus" <hello@.microb.com> wrote in message
news:bxNXd.22362$fW4.668343@.news20.bellglobal.com...
> No. I get the same name twice (the member's name is the same as the
father)
>