SELECT CID,GROUP_CONCAT(time ORDER BY time DESC SEPARATOR ","),GROUP_CONCAT(info ORDER BY time DESC SEPARATOR ",") GROUP BY CID 不知道能用不能用,如果能用的话,取","分隔的前两个
写错了。 SELECT CID,GROUP_CONCAT(time ORDER BY time DESC SEPARATOR ","),GROUP_CONCAT(info ORDER BY time DESC SEPARATOR ",") FROM A GROUP BY CID
select a.cid,a.info,a.time,b.info.b.time from table1 as a inner join table2 as b on a.cid=b.cid and a.id<>b.id and b.time >a.time group by a.cid;
select a.cid,a.info,a.time,b.info,b.time from table_name as a inner join table_name as b on a.cid=b.cid and a.id<>b.id and b.time >a.time group by a.cid;
改为 select a.cid,a.info,a.time,b.info,b.time from table_name as a inner join table_name as b on a.cid=b.cid where a.id<>b.id and b.time >a.time group by a.cid;
SELECT CID,GROUP_CONCAT(time ORDER BY time DESC SEPARATOR ","),GROUP_CONCAT(info ORDER BY time DESC SEPARATOR ",") FROM A GROUP BY CID
on a.cid=b.cid and a.id<>b.id and b.time >a.time group by a.cid;
select a.cid,a.info,a.time,b.info,b.time from table_name as a inner join table_name as b on a.cid=b.cid where a.id<>b.id and b.time >a.time group by a.cid;