I have two tables. 

MAP
===

```
 Product    Channel  Date   Advt Time 
Air    Pix  30-04-2011  22:23:16
Air    Pix  30-04-2011  23:55:08

```

MBA
===

```
 Product    Channel Date    StartTime EndTime 
Air    Pix  30-04-2011  22:00:00   01:00:00
Air    Pix  30-04-2011  23:00:00   02:00:00

```

I have to check whether AdvtTime in MAP is between the StartTime & EndTime in MBA table.

I used the below query 

```
select distinct * 
from MAP 
inner join MBA on (MAP.Channel     = MBA.Channel 
                   and MAP.Product = MBA.Product 
                   and MAP.ProgDate=MBA.ProgDate) 
where AdvtTime between ti and tii
order by Channel asc

```

But as the End Time extends till next day it gives no results.
Pls help me on how to proceed further.

I want:

* `22:23:16` to match `22:00:00` to `01:00:00`, and
* `23:55:08` to match `23:00:00` to `02:00:00`.