SELECT CID,GROUP_CONCAT(time ORDER BY time DESC SEPARATOR ","),GROUP_CONCAT(info ORDER BY time DESC SEPARATOR ",") GROUP BY CID 
不知道能用不能用,如果能用的话,取","分隔的前两个

解决方案 »

  1.   

    写错了。
    SELECT CID,GROUP_CONCAT(time ORDER BY time DESC SEPARATOR ","),GROUP_CONCAT(info ORDER BY time DESC SEPARATOR ",") FROM A GROUP BY CID 
      

  2.   

    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;
      

  3.   

    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;
      

  4.   

    改为
    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;