這是我的表 表BUSINESS
SQL連接兩個表,並計算平均
BUSINESSUSERNAME|BUSINESSPASSWORD|BUSINESSNAME| Res1 |123 |Cafe | Res2 |456 |Foodtruck |
表USER
USERNAME|USERPASSWORD|NAME| user1 |123 |mr.1| user2 |234 |mr.2|
表FOOD
FOODID|FOODNAME|FOODPRICE|BUSINESSUSERNAME|
1 |CAKE | 5 |Res1 |
2 |SHAKE | 2 |Res2 |
3 |COLA | 3 |Res1 |
表FOOD_RATING
FOODREVIEWID|FOODID|FOORATING|BUSINESSUSERNAME|USERNAME|
1 |2 |3 |Res2 |user1 |
2 |2 |5 |Res2 |user2 |
3 |1 |4 |Res1 |user1 |
4 |3 |1 |Res1 |user1 |
我想獲得該表 其中BUSINESSUSERNAME = 「RES1」
FOODNAME|FODPRICE|AVGRATING|
CAKE |5 |4 |
COLA |3 |1 |
選擇一個(MySQL和SQLSERVER,MSACCESS)。也爲什麼businessmenname存儲在食品和food_rating - 這應該可能改造 – amdixon