sql - Average Number on entries where ID is the same as another table -
i have database making microsoft access 2013, there 2 tables. first table has productid
primary key, second table has unique reviewid
productid
of product review referring to. in first table products information kept, want have field averages ratings given in it's reviews (kept in second table).
how average it's rating without averaging rating reviews, , reviews specific product?
based on descriptions i've created table called tblproducts following data:
i've created table called tblreview following data (here i've assumed have field store value each review's rating i've called reviewrating.. , i've assumed reviews rated 0-10):
i created query:
select tblproducts.productname, avg(tblreview.reviewrating) avgofreviewrating tblreview inner join tblproducts on tblreview.productid = tblproducts.productid group tblproducts.productname;
...which results in:
note select
query, won't put average review rating in original tblproducts table, need update
query. wouldn't recommend though you'll have remember run update before using tblproducts needs up-to-date averages.
Comments
Post a Comment