I need help with sql commands~ Thanks for your help in advance ^^
So I have 2 tables
How can I get the average from this 2 table.
The result that I want would be
Country Code 65 has 49.5 Frequency
Country Code 42 has 17 Frequency
Country Code 33 has 18 Frequency
Country Code 11 has 5 Frequency
Thank you very much!
You can query the two tables as a UNION ALL
then use that as a sub-query with a GROUP BY
and an AVG()
on the Frequency
column:
select cntry_cde, Avg(freq) as freq_avg
from
(
select t1.cntry_cde, t1.freq
from avg_call t1
union all
select t2.cntry_cde, t2.freq
from calls_at_one t2
)
group by cntry_cde;