Sería útil si preparara una tabla de muestra e inserciones de datos.
Lea este enlace para saber por qué es tan importante si desea obtener ayuda:http://tkyte.blogspot.com/2005/06/cómo-hacer-preguntas.html
Esta vez lo creé para ti, haz clic en este enlace: http://sqlfiddle.com/#!2/9719a/2
E intente esta consulta (encontrará esta consulta junto con datos de muestra en el enlace anterior):
select alias1.*,
timestampdiff( second, previous_viewed_at, viewed_at )
as time_between_viewings
from (
select alias.*,
(
select viewed_at from (
select
( select count(*) from asset_usages y
where x.asset_id = y.asset_id
and y.viewed_at < x.viewed_at
) as rn,
x.*
from asset_usages x
) xyz
where xyz.asset_id = alias.asset_id
and xyz.rn = alias.rn - 1
) previous_viewed_at
from (
select
( select count(*) from asset_usages y
where x.asset_id = y.asset_id
and y.viewed_at < x.viewed_at
) as rn,
x.*
from asset_usages x
) alias
) alias1;