Hi smile,
Refer below query.
SQL
CREATE TABLE #tblA(SireName VARCHAR(10),Total INT)
INSERT INTO #tblA VALUES('Milo',1)
INSERT INTO #tblA VALUES('Shootle',1)
INSERT INTO #tblA VALUES('Twist',3)
CREATE TABLE #tblB(SireName VARCHAR(10),Total INT)
INSERT INTO #tblB VALUES('Milo',1)
INSERT INTO #tblB VALUES('Shootle',2)
INSERT INTO #tblB VALUES('Twist',5)
SELECT p.SireName AS 'Sire',
(CAST(p.Total AS FLOAT)/(SELECT Total FROM #tblB b WHERE b.SireName = p.SireName))*100 AS 'Total'
FROM #tblA p
DROP TABLE #tblA
DROP TABLE #tblB
Output
Sire |
Total |
Milo |
100 |
Shootle |
50 |
Twist |
60 |