SELECT pencolony1.penID, Count(cowcolony1.cowID) AS CountOfcowID FROM pencolony1 INNER JOIN cowcolony1 ON pencolony1.penID = cowcolony1.penID GROUP BY pencolony1.penID
UNION ALL
SELECT pencolony2.penID, Count(cowcolony2.cowID) AS CountOfcowID FROM pencolony2 INNER JOIN cowcolony2 ON pencolony2.penID = cowcolony2.penID GROUP BY pencolony2.penID
UNION ALL
SELECT pencolony3.penID, Count(cowcolony3.cowID) AS CountOfcowID FROM pencolony3 INNER JOIN cowcolony3 ON pencolony3.penID = cowcolony3.penID GROUP BY pencolony3.penID;
|