SELECT exp_channel_titles.title, exp_channel_titles.url_title, exp_channel_titles.entry_id, exp_channel_data.field_id_602 AS entry_date, exp_channel_data.field_id_558 AS override, exp_channel_data.field_id_539 AS qof, exp_channel_data.field_id_483 AS deduction, exp_countries.tr_regions_regionid AS region, exp_matrix_data.row_id, exp_matrix_data.col_id_139 AS prog_name, exp_results.totaltime FROM exp_channel_titles INNER JOIN exp_channel_data ON exp_channel_titles.entry_id = exp_channel_data.entry_id INNER JOIN exp_countries ON exp_channel_data.field_id_13 = exp_countries.ISO_A2 INNER JOIN exp_matrix_data ON exp_channel_titles.entry_id = exp_matrix_data.entry_id INNER JOIN exp_results ON exp_matrix_data.row_id = exp_results.program_id WHERE exp_channel_titles.channel_id = '3' AND FROM_UNIXTIME(exp_channel_data.field_id_602) BETWEEN FROM_UNIXTIME(1388534400) AND FROM_UNIXTIME(1425586742) AND exp_matrix_data.col_id_139 = 'Junior Men' AND exp_results.position = 1 AND exp_channel_titles.entry_id IN( SELECT DISTINCT entry_id FROM exp_category_posts WHERE cat_id = 357 ) AND exp_channel_titles.entry_id IN( SELECT DISTINCT exp_category_posts.entry_id FROM exp_category_posts INNER JOIN exp_channel_data ON exp_category_posts.entry_id = exp_channel_data.entry_id WHERE cat_id = 348 OR (cat_id = 340 AND FROM_UNIXTIME(exp_channel_data.field_id_602) > FROM_UNIXTIME(1388534400)) ) GROUP BY exp_channel_titles.entry_id ORDER BY exp_channel_data.field_id_602 DESC