MySql 8连接字符串
在表MySql 8连接字符串,mysql,Mysql,在表table_c中存储了一个数据库MySql版本8.0.17我有这些行 -- ---------------------------- -- Table structure for table_c -- ---------------------------- DROP TABLE IF EXISTS `table_c`; CREATE TABLE `table_c` ( `contents` longtext DEFAULT NULL, `ID_contents` int(11)
table_c
中存储了一个数据库MySql版本8.0.17
我有这些行
-- ----------------------------
-- Table structure for table_c
-- ----------------------------
DROP TABLE IF EXISTS `table_c`;
CREATE TABLE `table_c` (
`contents` longtext DEFAULT NULL,
`ID_contents` int(11) DEFAULT NULL,
`ID` int(11) NOT NULL AUTO_INCREMENT,
PRIMARY KEY (`ID`) USING BTREE
) ENGINE = InnoDB;
-- ----------------------------
-- Records of table_c
-- ----------------------------
INSERT INTO `table_c` VALUES ('- Par 1', 1, 1);
INSERT INTO `table_c` VALUES ('Content 1.1', 1, 2);
INSERT INTO `table_c` VALUES ('1 Veni, vidi, vici', 1, 3);
INSERT INTO `table_c` VALUES ('2 Carpe diem', 1, 4);
INSERT INTO `table_c` VALUES ('3 Ubi maior minor cessat', 1, 5);
INSERT INTO `table_c` VALUES ('- Par 2', 2, 6);
INSERT INTO `table_c` VALUES ('Content 2.1', 2, 7);
INSERT INTO `table_c` VALUES ('1 Condicio sine qua non', 2, 8);
INSERT INTO `table_c` VALUES ('2 Carthago delenda est', 2, 9);
INSERT INTO `table_c` VALUES ('3 Inter sidera versor', 2, 10);
我需要这份报税表
+-------------+-------------------------------------------------------------------------+
| id_contents | Contents |
+-------------+-------------------------------------------------------------------------+
| 1 | 1 Veni, vidi, vici;2 Carpe diem;3 Ubi maior minor cessat |
| 2 | 1 Condicio sine qua non;2 Carthago delenda est;3 Inter sidera versor |
+-------------+-------------------------------------------------------------------------+
我试过但没有成功
任何帮助都将不胜感激。。。谢谢你…你就快到了。将
groupby id\u contents
添加到查询的末尾。您只需添加groupby子句,如下所示
GROUP BY id_contents