Sean Lange (2/8/2013)
dwain.c (2/7/2013)
How about something like this to avoid the self-join? Uses Sean's setup data.
SELECT Div_time, Unit_id
,TimeDifferenceMin=DATEDIFF(minute, MIN(Filled_Time), MAX(Filled_Time))
FROM #Something
GROUP BY Unit_id, Div_time
HAVING MAX(Filled_Time) <> MIN(Filled_Time)
Edit: Added the time difference.
+1 Thanks Dwain, not sure why I didn't come up with it.
+2
My first attempts to answer these somewhat vague questions often prove to be less than optimal. This community has a lot of brain-power behind it and I'm humbled and learning every day.