Android 一条sql用在即时通讯软件获取最近联系人,仿qq最近联系人效果

2014-04-27 20:41

sql用途,查询最近联系人,包括最后的联系时间,最后聊天的内容  用的sqlite 数据库

select * from (select member.uid as uid, member.realname as realname, chat.time as time , chat.content AS content from member  LEFT JOIN chat ON (((member.uid = chat.fromuid) and (chat.act ='receive')) or ((member.uid = chat.touid) and (chat.act ='send'))) ORDER BY chat.id asc) group by uid  order by time desc

^