Maybe this
MartinCode:select * from epg_event, (select min(start_time) as start_time,channel_oid from EPG_EVENT where start_time > datetime('now') group by channel_oid) next where epg_event.start_time = next.start_time and epg_event.channel_oid = next.channel_oid