select count( distinct UserID ) from MoguExt.dbo.T_HD_UserLog where HdID=4003 select sum(ParamsInt1) from MoguExt.dbo.T_HD_UserLog where HdID=4003 select * from MoguExt.dbo.T_HD_UserLog where HdID=4003 select Params1,sum(ParamsInt1),((select top 1 Params2 from MoguExt.dbo.T_HD_UserLog where HdID=4003 and Params1=logx.Params1 and ParamsInt2=1 )+'-'+(select top 1 Params2 from MoguExt.dbo.T_HD_UserLog where HdID=4003 and Params1=logx.Params1 and ParamsInt2=3 )) k from MoguExt.dbo.T_HD_UserLog logx where HdID=4003 group by Params1