(select distinct sc.name country, sc.link clink, flag.name flag,flag.name2 flag2, sl.id, sl.name league, sl.link slink, sl.description, sl.standing, ss.name ss_name, ss.link ss_link from soccer_match sm join soccer_league sl on sm.leaguecode=sl.id and sl.description like '% AND IS LEAF' join soccer_country sc on sl.country=sc.id join flag on sc.flag=flag.id join soccer_season ss on sc.season=ss.id where sm.type <> 3 and sm.home_id=10023 and sl.comp_id=0 and sl.is_current='1' and is_current='1' and is_national='1' and sc.name <> 'Friendly Games') union (select distinct sc.name country, sc.link clink, flag.name flag,flag.name2 flag2, sl.id, sl.name league, sl.link slink, sl.description, sl.standing, ss.name ss_name, ss.link ss_link from soccer_match sm join soccer_league sl on sm.leaguecode=sl.id and sl.description like '% AND IS LEAF' join soccer_country sc on sl.country=sc.id join flag on sc.flag=flag.id join soccer_season ss on sc.season=ss.id where sm.type <> 3 and sm.away_id=10023 and sl.comp_id=0 and sl.is_current='1' and is_current='1' and is_national='1' and sc.name <> 'Friendly Games') order by sc.name, sl.sort sql error