Table_1 ID Name 1 AAA 2 BBB 3 ccc
Table_2 ID Sub Marks 1 M1 50 1 m2 65 2 M1 89 2 M2 93 3 M1 89 3 M2 56
ID Name Avg 2 BBB 91 3 CCC 72.5 1 AAA 57.5
SELECT DISTINCT Id, Name, AVG(Marks) as Avg FROM Table_2 JOIN Table_1 ON Table_2.ID = Table_1.ID ORDER BY Avg
SELECT t2.ID, t1.Name, AVG(t2.Marks) AS Average FROM Table_2 t2 JOIN Table_1 t1 ON t1.ID = t2.ID GROUP BY t2.ID , t1.Name ORDER BY Average DESC
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)