Below is a result of a table ordered by start\_time, 

```
START_TIME                START_LOCATION_ID END_TIME               END_LOCATION_ID
------------------------- -------------- ------------------------- ------------ 
16/05/2014 12:15:00 am    1              16/05/2014 12:20:00 am    2          
16/05/2014 12:25:00 am    2              16/05/2014 12:30:00 am    3          
16/05/2014 12:35:00 am    3              16/05/2014 12:40:00 am    1          
16/05/2014 12:45:00 am    1              16/05/2014 12:50:00 am    6          
16/05/2014 12:55:00 am    6              16/05/2014 01:00:00 am    7          
16/05/2014 01:05:00 am    7              16/05/2014 01:10:00 am    1          
16/05/2014 01:15:00 am    1              16/05/2014 01:20:00 am    2          
16/05/2014 01:25:00 am    2              16/05/2014 01:30:00 am    4          
16/05/2014 01:35:00 am    4              16/05/2014 01:40:00 am    3          
16/05/2014 01:45:00 am    3              16/05/2014 01:50:00 am    1

```

I need to filter as the output looks like follows if the input is given as start\_location\_id = 1 and end\_location\_id = 3.

```
START_TIME                START_LOCATION_ID END_TIME               END_LOCATION_ID
------------------------- -------------- ------------------------- ------------
16/05/2014 12:15:00 am    1              16/05/2014 12:20:00 am    2          
16/05/2014 12:25:00 am    2              16/05/2014 12:30:00 am    3                    
16/05/2014 01:15:00 am    1              16/05/2014 01:20:00 am    2          
16/05/2014 01:25:00 am    2              16/05/2014 01:30:00 am    4         
16/05/2014 01:35:00 am    4              16/05/2014 01:40:00 am    3          

```

I don't know how to start querying as I know the condition 'WHERE start\_location\_id = 1 and end\_location\_id = 3' won't work as expected.,  

Image preview >>[here](http://www.imagesup.net/?di=414003487704)<<   

Please help and Thanks in advance.