Assuming a structure, at its simplest, as:
CREATE TABLE table1 (id INT, a INT)
CREATE TABLE table2 (id INT, b INT)
INSERT INTO table1
SELECT 1,1 UNION SELECT 2,2 UNION SELECT 3,3
INSERT INTO table2
SELECT 1,1 UNION SELECT 2,2 UNION SELECT 3,3
Then:
CREATE TABLE table3 (id INT IDENTITY(1,1), e INT, f INT,
divided AS ((e/f) * CAST(1 AS DECIMAL(10,2)) ) )
INSERT INTO table3 (e, f)
SELECT (SUM(t1.a) / COUNT(t1.id)) [e],
(SUM(t2.b) / COUNT(t2.id)) [f]
FROM table1 t1, table2 t2
The 'divided' column in table3 will be your result. You can use temporary tables instead of permanent ones for simplicity.
Tested OK.
---
Note to developers:Want to get the best help? Click here https://www.sqlservercentral.com/articles/forum-etiquette-how-to-post-datacode-on-a-forum-to-get-the-best-help (Jeff Moden)
My blog: http://uksqldba.blogspot.com
Visit http://www.DerekColley.co.uk to find out more about me.