All pastes #285093 Raw Edit

Mine

public sql v1 · immutable
#285093 ·published 2006-12-19 16:32 UTC
rendered paste body
			SELECT 				c.channel_name, a.program_title, 				TIME_FORMAT( a.start_time, '%H:%i' ) AS start_time, 				TIME_FORMAT( a.finish_time, '%H:%i' ) AS finish_time			FROM 				channel c 			INNER JOIN				program a ON a.channel_id = c.channel_id 			INNER JOIN 				program b ON a.channel_id = b.channel_id 			AND 				a.start_time >= b.start_time 			AND						b.date = CURRENT_DATE()			AND				b.finish_time BETWEEN CURRENT_TIME()			AND 				ADDTIME(CURRENT_TIME(), '12:00:00') 			GROUP BY 				a.channel_id, a.program_title, a.start_time, a.finish_time 			HAVING COUNT(*) 				<= 2			ORDER BY 				a.channel_id, a.start_time