This is my table “dog”
– Table structure for table dog
CREATE TABLE IF NOT EXISTS dog
(
id
int(20) NOT NULL auto_increment,
reg_nr
varchar(80) collate utf8_unicode_ci default NULL,
name
varchar(80) collate utf8_unicode_ci NOT NULL,
postTitle
varchar(80) collate utf8_unicode_ci default NULL,
HipList
varchar(80) collate utf8_unicode_ci default NULL,
sex
enum(‘male’,‘female’) collate utf8_unicode_ci default NULL,
yearofbirth
smallint(4) default NULL,
monthofbirth
tinyint(4) default NULL,
dayofbirth
tinyint(4) default NULL,
yearofdeath
smallint(4) default NULL,
monthofdeath
tinyint(4) default NULL,
dayofdeath
tinyint(4) default NULL,
landofbirth
varchar(80) collate utf8_unicode_ci default NULL,
landofstanding
varchar(80) collate utf8_unicode_ci default NULL,
size
varchar(80) collate utf8_unicode_ci default NULL,
weight
float default NULL,
callName
varchar(80) collate utf8_unicode_ci default NULL,
coi
double default NULL,
source
varchar(80) collate utf8_unicode_ci default NULL,
title
varchar(512) collate utf8_unicode_ci default NULL,
Zuchtschau
varchar(80) collate utf8_unicode_ci default NULL,
sire_id
int(20) default NULL,
dam_id
int(20) default NULL,
notes
varchar(2048) collate utf8_unicode_ci default NULL,
changed
timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP,
creator
int(10) default NULL,
last_modifier
int(10) default NULL,
eyeTest
varchar(80) collate utf8_unicode_ci default NULL,
elbows
varchar(80) collate utf8_unicode_ci default NULL,
Thyroid
varchar(80) collate utf8_unicode_ci default NULL,
dentition
varchar(80) collate utf8_unicode_ci default NULL,
heartTest
varchar(80) collate utf8_unicode_ci default NULL,
causeDeath
varchar(80) collate utf8_unicode_ci default NULL,
hiddenNotes
varchar(2048) collate utf8_unicode_ci default NULL,
LonghairCarrier
enum(‘YES’,‘NO’) collate utf8_unicode_ci default NULL,
hipText
varchar(80) collate utf8_unicode_ci default NULL,
Hunting
varchar(2048) collate utf8_unicode_ci default NULL,
Wesenstest
varchar(80) collate utf8_unicode_ci default NULL,
Variety
enum(‘Shorthair’,‘Longhair’) collate utf8_unicode_ci default NULL,
PRIMARY KEY (id
),
KEY sire_id
(sire_id
),
KEY dam_id
(dam_id
)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=179839 ;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT /;
/!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS /;
/!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
This is my table “topsires”
– Structure for view TopSires
CREATE ALGORITHM=UNDEFINED DEFINER=weimaran
@localhost
SQL SECURITY DEFINER VIEW TopSires
AS select count(0) AS Anzahl
,a
.sire_id
AS sire_id
from dog
a
where (a
.sire_id
is not null) group by a
.sire_id
order by count(0) desc limit 150;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT /;
/!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS /;
/!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
And last table “topsires1”
– Structure for view TopSires1
CREATE ALGORITHM=UNDEFINED DEFINER=weimaran
@localhost
SQL SECURITY DEFINER VIEW TopSires1
AS select TopSires
.Anzahl
AS Anzahl
,TopSires
.sire_id
AS topd_id
,dog
.name
AS name
,dog
.sire_id
AS topsire_id
,dog
.dam_id
AS topdam_id
from (TopSires
join dog
) where (TopSires
.sire_id
= dog
.id
);
–
– VIEW TopSires1
– Data: None
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT /;
/!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS /;
/!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
And basically I want to get rid of the tables topsires.
I have also those tables from top dams.
While IMO it is unnecessary those tables there you can get the info straight out of my dog database