I have a page where animal records are stored. In the records we have a couple of drop down which show the parentage of the animal. One is for the dam and one is for the sire. Obviously, I have have to have inherit access permissions ticked. I unticked the check box in Appgini so that I could change the default permissions. I had for one of them:
Code: Select all
SELECT `animals`.`id`, `animals`.`name` FROM `animals` WHERE `animals`.`sex` !='female' ORDER BY 2
and the other:
Code: Select all
SELECT `animals`.`id`, `animals`.`name` FROM `animals` WHERE `animals`.`sex` !='male' ORDER BY 2
I tried to chenge the default to:
Code: Select all
SELECT `animals`.`id`, `animals`.`name` FROM `animals` LEFT JOIN `livestock_species` as livestock_species1 ON `livestock_species1`.`id`=`animals`.`species` LEFT JOIN `livestock_breed` as livestock_breed1 ON `livestock_breed1`.`id`=`animals`.`breed` LEFT JOIN `animals` as animals1 ON `animals1`.`id`=`animals`.`sire` LEFT JOIN `animals` as animals2 ON `animals2`.`id`=`animals`.`dam` WHERE `animals`.`sex` !='male' ORDER BY 2
Under the lookup for Sire, only the males should show and the same for Dam, only the females should be displayed.
Hoping someone can see what I am doing wrong, please.