Let\'s say you have the following table (the column of interest here is cid):
cid
+-----+-------+-------+-------+---------------------+-------------
Try this one,
SELECT * FROM tableName a INNER JOIN ( SELECT cid, MIN(`time`) AS MinTime FROM tableName GROUP BY cid ) b ON a.CID = B.cid AND a.time = b.MinTime