Entrada de horário SQLLite e saída de horário do evento

Eu tenho duas mesas,DATA eEVENTS, com os seguintes dados:

EVENTS
EventIndex  ObjID   LocID   EventData   EventTime       EventType
83707365    3519434 10376   0           2013-05-19 11:32:11 137
83707849    3519434 10374   0           2013-05-19 11:35:18 137 
83714233    888799  10376   0           2013-05-19 12:24:45 137 
83715200    888799  10184   0           2013-05-19 12:32:18 137

DATA
EventIndex  TagName TagValue    
83714233    ObjName Peter
83714233    LocName H118
83715200    ObjName Peter
83715200    LocName H116
83707365    ObjName John
83707365    LocName H118
83707849    ObjName John
83707849    LocName H116

Onde eu começo com uma consulta SQL SQLLite?

Eu quero obter os resultados:

Name   Location  Entry      Exit        Total
Peter  H118      12:24:45   12:32:18    00:07:33
John   H118      11:32:11   11:35:18    00:03:07

Oi meewoK, pode dar o seguinte caso:

Nome Localização Entrada Saída Total
Peter H118 12:24:45 12:32:18 00:07:33
John H118 11:32:11 11:35:18 00:03:07
João H118 11:44:52 11:45:27 00:00:35
João H118 12:31:15 12:32:46 00:01:31

e estou tentando modificar sua consulta e não consigo encontrar a solução. obrigado

Este código funciona no SQL SERVER:

SELECT E.EventIndex, N.tagvalue como nome, L.tagvalue como localização, E.eventtime como entrada, NEV. [Saída]
DE
[EVENTOS] E
INNER JOIN [DATA] N NO E.EventIndex = N.eventindex AND N.tagname = 'ObjName'
INNER JOIN [DATA] L ON E.EventIndex = L.eventindex E L.tagname = 'LocName'
EXTERIOR APLICAR (
SELECT TOP (1) NE.eventtime AS [Sair]
DE
[EVENTOS] NE
INNER JOIN [DATA] NL ON NE.EventIndex = NL.eventindex E NL.tagname = 'ObjName'
ONDE
NE.EventIndex> E.EventIndex
AND NL.tagvalue = N.tagvalue
ORDENAR POR
NE.EventIndex

) NEV  

ONDE L.tagvalue = 'H118'

Alguém poderia me ajudar a passar para o SQLite? obrigado

questionAnswers(2)

yourAnswerToTheQuestion