[sql]代码库
use equip
go
SELECT
t1.[SubTime]
,t2.[SubTime]
,t1.[OrgAddr]
,t1.[DestAddr]
,t1.[SM_Content]
,t1.[SendTime]
,t2.[SendTime]
,t1.[MsgID]
,t1.[Service_ID]
,t1.[Fee_UserType]
,t1.[Fee_Terminal_ID]
FROM [dbo].[tbl_SMResult_temp] t1,[dbo].[tbl_SMResult_temp] t2
where t1.[DestAddr] = t2.[DestAddr] and t1.[SubTime]<>t2.[SubTime]
and t1.[SM_Content] = t2.[SM_Content]
and abs(cast(t1.[SubTime] as float) - cast(t2.[SubTime] as float))< 1.0/24.0
and t1.[SubTime]>='2015-5-10' and t1.[SubTime]<='2015-5-11'
and t2.[SubTime]>='2015-5-10' and t2.[SubTime]<='2015-5-11'
order by t1.[SubTime]