select * from ( select cv.lasttime,cm.mailbox,cv.clientip from `co_user_visitlog` as cv INNER JOIN `core_mailbox` as cm where cv.mailbox_id = cm.mailbox_id and cm.mailbox in
( 'pyj@test.com','cs@test.com','cs2@test.com','cs1@test.com' )order by cv.lasttime desc ) as t group by t.mailbox;
在一条语句里面不可以先order by 再进行group by
最终套了一个查询,然后再group by 出来