I'm relatively new to SQL, and am frequently running into the same problem, How do I compare different rows in a
result?<br/><br />for example:<br />If I have a table of events consisting of a time stamp and the event type:<br
/><br/>timestamp, event_type<br />12:00 a<br />12:10 b<br />12:20
a<br/>...<br /><br />I'd like to be able to select all the 'a' type events and calculate the time since the previous
'a'event, to get:<br /> timestamp, event_type, time_since_last<br /> 12:00
a 0:20<br /> 12:20 a NULL<br /><br />What's the
bestway to to accomplish this? <br /><br /><br />Thanks in advance,<br />Murray<br /><br /><br /><br />