以下是我的reviews
表:它是一个主要评分位置的通用评论表。
+---------------+---------------+------+-----+---------+----------------+
| Field | Type | Null | Key | Default | Extra |
+---------------+---------------+------+-----+---------+----------------+
| reviewid | int(11) | NO | PRI | NULL | auto_increment |
| createdate | int(11) | YES | | 0 | |
| locid | int(11) | YES | MUL | 0 | |
| clubid | int(11) | YES | | 0 | |
| userid | int(11) | YES | MUL | 0 | |
| legacyuser | int(11) | YES | | 0 | |
| author | varchar(100) | YES | | | |
| comment | varchar(4000) | YES | | | |
| rating | double | YES | | NULL | |
| status | int(11) | YES | | 1 | |
| likes | int(11) | YES | | 0 | |
| dislikes | int(11) | YES | | 0 | |
| spotlight | int(11) | YES | | 0 | |
| dancerquality | double | YES | | 0 | |
| pvtdancevalue | double | YES | | 0 | |
| hospitality | double | YES | | 0 | |
| dancerratio | double | YES | | 0 | |
| dancervariety | double | YES | | 0 | |
| covervalue | double | YES | | 0 | |
| drinksvalue | double | YES | | 0 | |
| foodvalue | double | YES | | 0 | |
| atmosphere | double | YES | | 0 | |
| soundsystem | double | YES | | 0 | |
| rebuttal | varchar(5000) | YES | | | |
+---------------+---------------+------+-----+---------+----------------+
如果你看一下,你会在这里看到这三个重要的列:
这就是我需要的东西:
平均值(平均价值+平均饮酒价值+平均食物价值)
我的假设是,平均值的平均值将为我提供最佳的定价价值。
这是我当前的查询:
select avg(avg(foodvalue)+avg(drinksvalue)+avg(covervalue)) as avg from reviews where locid=3166;
以下是回复ERROR 1111 (HY000): Invalid use of group function
这显然不起作用,否则我不在这里。不太确定怎么做?