liveid point userid 1 2 10 2 3 10
postid cdr userid 1 34 10 2 23 10 3 45 10 4 24 20
userid sum avg Totalp Totalreal 10 5 3 2 3 20 0 0 0 1
SELECT t.userid,sum(r.point)'sum',ROUND(AVG(r.point))'avg',COUNT(r.point)'Totalp',COUNT(t.userid)'Totalreal' FROM T2 t LEFT JOIN T1 r USING (userid) GROUP BY t.userid
userid sum avg Totalp Totalreal 10 15 3 6 6 20 NULL NULL 0 1
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)