本文目录一览:
用SQL查看QQ聊天记录
不行,这个格式是QQ的专有格式,经过加密的,只能用QQ的查看工具查看。
sql语句 聊天记录,取用户最新一条
create table t_df(sendid int,ToID int,sendtime varchar(12),Message varchar(100));
go
insert into t_df values( 1,2,'12:30','内容1');
insert into t_df values( 2,1,'12:31','内容2');
insert into t_df values( 3,1,'12:33','内容3');
insert into t_df values( 3,1,'12:34','内容4');
insert into t_df values( 1,4,'12:41','内容5');
go
select * from t_df
where sendid in( select sendid from t_df where sendid = 1 or ToID = 1 group by sendid)
and sendtime in (select max(sendtime) from t_df where sendid = 1 or ToID = 1 group by sendid)order by sendtime
注意:t_df 为表名
查询结果:
sql语句 聊天记录,取最新一条
select * from tabname t1,
(select fid,max(time) time
from tabname
group by fid) max1
where t1.fid = max1.fid and t1.time = max1.time