如何从表中获取 count_id 和 rating_evarate?
我想计算 id 并从下表中获得 rating evarate 。
我怎么能在 mysql 中做到这一点。
SET FOREIGN_KEY_CHECKS=0;
-- ----------------------------
-- Table structure for `rating`
-- ----------------------------
DROP TABLE IF EXISTS `rating`;
CREATE TABLE `rating` (
`id` int(11) NOT NULL,
`rating` int(11) NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
-- ----------------------------
-- Records of rating
-- ----------------------------
INSERT INTO `rating` VALUES ('1', '5');
INSERT INTO `rating` VALUES ('2', '0');
INSERT INTO `rating` VALUES ('3', '0');
INSERT INTO `rating` VALUES ('4', '0');
INSERT INTO `rating` VALUES ('2', '0');
INSERT INTO `rating` VALUES ('1', '0');