select temp.*

DATEDIFF(MI,temp.statusDATa+cast(TEMP.statustime as datetime),A.statusDATa+cast(A.statustime as datetime)) '时间差(分钟)'

from temp,(select * from temp) a

where temp.sectionno=a.sectionno

and temp.positionno=a.positionno

and temp.stastustype='B'

and a.stastustype='R'

以下是截图