Oracle - Help with query with a date field and two different types of events to display a single row

0

I have a table that registers some events of entry and exit, it keeps the date with time, the id of the user and the type of event.

TABLE:

  TABLA_ID | USUARIO_ID | FECHA_HORA          | TIPO_EVENTO
  1        | 1          | 2018-08-01 18:14:22 | ENTRADA
  2        | 1          | 2018-08-01 18:20:02 | SALIDA
  3        | 1          | 2018-08-01 18:25:22 | ENTRADA
  4        | 1          | 2018-08-01 18:30:22 | SALIDA

The question is that I must put together an SQL query that allows me to show the events in the following way:

USUARIO_ID | FECHA      | HORA ENTRADA | HORA SALIDA
1          | 2018-08-01 | 18:14:22     | 18:20:02
1          | 2018-08-01 | 18:25:22     | 18:30:02

I would be very grateful if you can give me some idea of a consultation, since until now I have not been able to and I can not think of a solution: (

The database is Oracle in its 12C version.

    
asked by Fernando Guevara 06.08.2018 в 21:35
source

0 answers