Tag Archives: self join on one table

self join on one table

I have a table STARTSTOP

Action 0 -> START ACTION
Action 1 -> STOP ACTION
DATA is a timestamp of action

I would like to run a select statement that would return records something like:

OR summary for all actions duration in one row.

Is it feasible with a single database query? (without creating additional tables)

DATEDIFF function

SQLFiddle Example for MSSQL yet it has to work under Firebird too