Halfsibling - same mother????

Questions about the MySQL, PostgreSQL, and most other databases, as well as using it with PHP can be asked here.

Moderator: General Moderators

Post Reply
Apophis
Forum Newbie
Posts: 13
Joined: Fri Jul 28, 2006 7:56 am

Halfsibling - same mother????

Post by Apophis »

Everah | Please use

Code: Select all

,

Code: Select all

and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read:  [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]


Hi,

I am trying to build a database (and that works fine) but i want to have an output when i ask for excample "Halfsibling - same mother:"

details of the database:

[syntax="sql"]CREATE TABLE `dog_table` (
`Id` int(11) NOT NULL auto_increment,
`DogRegis` varchar(30) default NULL,
`DogName` varchar(50) default NULL,
`DogTitle` varchar(60) default NULL,
`Callname` varchar(20) default NULL,
`DOB` date default NULL,
`DOD` date default NULL,
`Gender` varchar(20) default NULL,
`Color` varchar(20) default NULL,
`FatherId` int(11) default NULL,
`MotherId` int(11) default NULL,
`WrightCoef` varchar(20) default NULL,
`CountryOrig` varchar(20) default NULL,
`Kennel` varchar(20) default NULL,
`Breeder` varchar(20) default NULL,
PRIMARY KEY (`Id`),
UNIQUE KEY `DGPrimRegNbr` (`DogRegis`,`DogName`)
) ENGINE=MyISAM
Can some one help me with a script for displaying halfsiblings - same mother??

Thanks for the help.


Everah | Please use[/syntax]

Code: Select all

,

Code: Select all

and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read:  [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]
User avatar
Ollie Saunders
DevNet Master
Posts: 3179
Joined: Tue May 24, 2005 6:01 pm
Location: UK

Post by Ollie Saunders »

what's stopping you assigning two entires in dog_table to the same MotherId?
Apophis
Forum Newbie
Posts: 13
Joined: Fri Jul 28, 2006 7:56 am

Post by Apophis »

assigning two entries to the table with the same MotherId is not a problem. I can't get it wright to get an output of the dogs ho have the same mother. :wink:
User avatar
Ollie Saunders
DevNet Master
Posts: 3179
Joined: Tue May 24, 2005 6:01 pm
Location: UK

Post by Ollie Saunders »

Code: Select all

SELECT  * FROM dog_table WHERE MotherId = 3
Can return any number of rows
Apophis
Forum Newbie
Posts: 13
Joined: Fri Jul 28, 2006 7:56 am

Post by Apophis »

This is the page of my dog.

http://www.wanyika.be/pedigree/pedigree ... 7036&Gen=4

My dog is having a mother with a id of 2191.

Code: Select all

SELECT * FROM `dog_table` WHERE `MotherId` = 2191 ORDER BY DogName ASC 
this works perfect with mysql.
Below of that page i want to have a link, if i thake that it most know what mother and display the result. How do i do that with PHP
User avatar
Ollie Saunders
DevNet Master
Posts: 3179
Joined: Tue May 24, 2005 6:01 pm
Location: UK

Post by Ollie Saunders »

Sorry I can't understand, please rephrase your question.
User avatar
RobertGonzalez
Site Administrator
Posts: 14293
Joined: Tue Sep 09, 2003 6:04 pm
Location: Fremont, CA, USA

Post by RobertGonzalez »

Moved to Databases.
Apophis
Forum Newbie
Posts: 13
Joined: Fri Jul 28, 2006 7:56 am

Problem solved

Post by Apophis »

No help needed. I have solved the problem after a good night sleep.
User avatar
RobertGonzalez
Site Administrator
Posts: 14293
Joined: Tue Sep 09, 2003 6:04 pm
Location: Fremont, CA, USA

Post by RobertGonzalez »

Mind sharing your solution so others can benefit from your fervent efforts? And please edit your original post title and add '[SOLVED] - ' to the beginning. Thanks.
Post Reply