SELECT M.*
, M.time_start time_start
, M.time time_end
, M.duration_pause
, M.type_match_add type_match
, M.type_tournoi_add type_tournament
, M.niveau level
, M.qualif
, M.idw winner_id
, P1.id p1_id
, P1.nom p1_name
, P1.prenom p1_first_name
, P1.name_zh p1_name_zh
, P1.birthday p1_birthday
, P1.sexe p1_gender
, P1.nat p1_nat
, P1.photo p1_photo
, P1.taille p1_height
, P1.poids p1_weight
, R1.rank p1_rank
, R1.liveRank p1_rank_live
, P1.pro_depuis p1_turn_pro
, '?' p1_best_rank
, P1.prise p1_forehand
, P1.revers p1_backhand
, M.ts1 p1_seed
, P1B.id p1b_id
, P1B.nom p1b_name
, P1B.prenom p1b_first_name
, P1B.name_zh p1b_name_zh
, P1B.birthday p1b_birthday
, P1B.sexe p1b_gender
, P1B.nat p1b_nat
, P1B.photo p1b_photo
, P1B.taille p1b_height
, P1B.poids p1b_weight
, R1B.rank p1b_rank
, R1B.liveRank p1b_rank_live
, P1B.pro_depuis p1b_turn_pro
, P2.id p2_id
, P2.nom p2_name
, P2.prenom p2_first_name
, P2.name_zh p2_name_zh
, P2.birthday p2_birthday
, P2.sexe p2_gender
, P2.nat p2_nat
, P2.photo p2_photo
, P2.taille p2_height
, P2.poids p2_weight
, R2.rank p2_rank
, R2.liveRank p2_rank_live
, P2.pro_depuis p2_turn_pro
, '?' p2_best_rank
, P2.prise p2_forehand
, P2.revers p2_backhand
, M.ts2 p2_seed
, P2B.id p2b_id
, P2B.nom p2b_name
, P2B.prenom p2b_first_name
, P2B.name_zh p2b_name_zh
, P2B.birthday p2b_birthday
, P2B.sexe p2b_gender
, P2B.nat p2b_nat
, P2B.photo p2b_photo
, P2B.taille p2b_height
, P2B.poids p2b_weight
, R2B.rank p2b_rank
, R2B.liveRank p2b_rank_live
, P2B.pro_depuis p2b_turn_pro
, T.id tournament_id
, T.idt tournament_idt
, '?' rencontre_id
, N.name_fr tournament_name_fr
, N.name_en tournament_name_en
, N.name_zh tournament_name_zh
, N.name_de tournament_name_de
, N.name_es tournament_name_es
, T.ville tournament_city
, T.stade tournament_stadium
, T.surface tournament_surface
, T.surface_photo tournament_surface_photo
, T.surface_color tournament_surface_color
, T.monnaie tournament_currency
, T.prix tournament_prize_money
, SCO.nom_fr tournament_country
, T.logo tournament_logo
, T.debut tournament_start
, T.fin tournament_end
, T.nbj tournament_nbPlayer
, T.genre tournament_genre
, T.category tournament_category
, T.type tournament_type
, T.ids tournament_site
, T.year tournament_year
, T.importance tournament_importance
, '' team1
, '' team2
, T.importance
, T.background tournament_background
, SC.fuseau_horaire
, IF(ISNULL(LS.status) || M.status = 2 || M.status = 3 || M.status = 4, M.status, LS.status) match_status
, LS.serve
, S.time s_time_start
, S.court
, S.date_loc
, S.type s_type
, S.ordre s_order
, C.nom court_name
, C.ordre court_order
FROM
tournois_matchs M
INNER JOIN joueurs P1 on P1.id = M.j1
LEFT OUTER JOIN `joueurs` P1B on P1B.id = M.j1_bis
INNER JOIN joueurs P2 on P2.id = M.j2
LEFT OUTER JOIN `joueurs` P2B on P2B.id = M.j2_bis
LEFT JOIN tennis_rankings R1 on R1.player = P1.id AND R1.id = IF(P1.sexe = 1, 'wta', 'atp')
LEFT JOIN tennis_rankings R1B on R1B.player = P1B.id AND R1B.id = IF(P1B.sexe = 1, 'wta', 'atp')
LEFT JOIN tennis_rankings R2 on R2.player = P2.id AND R2.id = IF(P2.sexe = 1, 'wta', 'atp')
LEFT JOIN tennis_rankings R2B on R2B.player = P2B.id AND R2B.id = IF(P2B.sexe = 1, 'wta', 'atp')
INNER JOIN tournois T on T.id = M.idt
INNER JOIN tournois_name N on N.id = T.id && N.cup = 0
LEFT OUTER JOIN lieux_sites SL on T.ids = SL.id
LEFT OUTER JOIN lieux_villes SC on SL.idv = SC.id
LEFT OUTER JOIN lieux_pays SCO on SCO.code = SC.pays
LEFT OUTER JOIN `livescores_new`.`matchs` LS on LS.tt_match_id = M.id
LEFT OUTER JOIN tournois_programmes S on S.idm = M.id
LEFT OUTER JOIN lieux_courts C on C.ids = S.ids && C.ordre = S.court
WHERE
M.id = '4063818'
&& M.type_tournoi_add = 0
&& (S.statut = 0 || S.statut = 4 || S.statut = 2 || ISNULL(S.statut))
UNION
SELECT
M.*
, M.time_start time_start
, M.time time_end
, M.duration_pause
, M.type_match_add type_match
, M.type_tournoi_add type_tournament
, CR.niveau level
, M.qualif
, M.idw winner_id
, P1.id p1_id
, P1.nom p1_name
, P1.prenom p1_first_name
, P1.name_zh p1_name_zh
, P1.birthday p1_birthday
, P1.sexe p1_gender
, P1.nat p1_nat
, P1.photo p1_photo
, P1.taille p1_height
, P1.poids p1_weight
, R1.rank p1_rank
, R1.liveRank p1_rank_live
, P1.pro_depuis p1_turn_pro
, '?' p1_best_rank
, P1.prise p1_forehand
, P1.revers p1_backhand
, M.ts1 p1_seed
, P1B.id p1b_id
, P1B.nom p1b_name
, P1B.prenom p1b_first_name
, P1B.name_zh p1b_name_zh
, P1B.birthday p1b_birthday
, P1B.sexe p1b_gender
, P1B.nat p1b_nat
, P1B.photo p1b_photo
, P1B.taille p1b_height
, P1B.poids p1b_weight
, R1B.rank p1b_rank
, R1B.liveRank p1b_rank_live
, P1B.pro_depuis p1b_turn_pro
, P2.id p2_id
, P2.nom p2_name
, P2.prenom p2_first_name
, P2.name_zh p2_name_zh
, P2.birthday p2_birthday
, P2.sexe p2_gender
, P2.nat p2_nat
, P2.photo p2_photo
, P2.taille p2_height
, P2.poids p2_weight
, R2.rank p2_rank
, R2.liveRank p2_rank_live
, P2.pro_depuis p2_turn_pro
, '?' p2_best_rank
, P2.prise p2_forehand
, P2.revers p2_backhand
, M.ts2 p2_seed
, P2B.id p2b_id
, P2B.nom p2b_name
, P2B.prenom p2b_first_name
, P2B.name_zh p2b_name_zh
, P2B.birthday p2b_birthday
, P2B.sexe p2b_gender
, P2B.nat p2b_nat
, P2B.photo p2b_photo
, P2B.taille p2b_height
, P2B.poids p2b_weight
, R2B.rank p2b_rank
, R2B.liveRank p2b_rank_live
, P2B.pro_depuis p2b_turn_pro
, C.id tournament_id
, C.parent tournament_idt
, CR.id rencontre_id
, N.name_fr tournament_name_fr
, N.name_en tournament_name_en
, N.name_zh tournament_name_zh
, N.name_de tournament_name_de
, N.name_es tournament_name_es
, CONCAT(CR.equipe_domicile, '|', CR.equipe_exterieur) tournament_city
, '' tournament_stadium
, CR.surface tournament_surface
, '' tournament_surface_photo
, '0' tournament_surface_color
, '' tournament_currency
, '' tournament_prize_money
, SCO.nom_fr tournament_country
, '' tournament_logo
, CR.date_d tournament_start
, '' tournament_end
, C.nbj tournament_nbPlayer
, '' tournament_genre
, '' tournament_category
, '' tournament_type
, CR.lieu tournament_site
, '' tournament_year
, 65 tournament_importance
, IF(T1.nom_fr, T1.nom_fr, CR.equipe_domicile) team1
, IF(T2.nom_fr, T1.nom_fr, CR.equipe_exterieur) team2
, 65 importance
, '' tournament_background
, SC.fuseau_horaire
, IF(ISNULL(LS.status) || M.status = 2 || M.status = 3 || M.status = 4, M.status, LS.status) match_status
, LS.serve
, S.time s_time_start
, S.court
, S.date_loc
, S.type s_type
, S.ordre s_order
, CT.nom court_name
, CT.ordre court_order
FROM
tournois_matchs M
INNER JOIN joueurs P1 on P1.id = M.j1
LEFT OUTER JOIN `joueurs` P1B on P1B.id = M.j1_bis
INNER JOIN joueurs P2 on P2.id = M.j2
LEFT OUTER JOIN `joueurs` P2B on P2B.id = M.j2_bis
LEFT JOIN tennis_rankings R1 on R1.player = P1.id AND R1.id = IF(P1.sexe = 1, 'wta', 'atp')
LEFT JOIN tennis_rankings R1B on R1B.player = P1B.id AND R1B.id = IF(P1B.sexe = 1, 'wta', 'atp')
LEFT JOIN tennis_rankings R2 on R2.player = P2.id AND R2.id = IF(P2.sexe = 1, 'wta', 'atp')
LEFT JOIN tennis_rankings R2B on R2B.player = P2B.id AND R2B.id = IF(P2B.sexe = 1, 'wta', 'atp')
LEFT OUTER JOIN `livescores_new`.`matchs` LS ON (LS.tt_match_id = M.id)
LEFT OUTER JOIN tournois_programmes S on S.idm = M.id
LEFT OUTER JOIN lieux_courts CT on (CT.ids = S.ids && CT.ordre = S.court)
INNER JOIN `coupes_rencontres` CR on CR.id = M.idt
INNER JOIN `coupes` C on C.id = CR.coupe_id
INNER JOIN tournois_name N on N.id = C.id
LEFT JOIN lieux_sites SL on SL.id = CR.lieu
LEFT JOIN lieux_villes SC on SC.id = SL.idv
LEFT JOIN lieux_pays SCO on SCO.code = SC.pays
LEFT JOIN `lieux_pays` T1 ON (T1.code = CR.equipe_domicile)
LEFT JOIN `lieux_pays` T2 ON (T2.code = CR.equipe_exterieur)
WHERE
M.id = '4063818'
&& M.type_tournoi_add = 1
&& (S.statut = 0 || S.statut = 4 || S.statut = 2 || ISNULL(S.statut))
UNION
SELECT
M.*
, M.time_start time_start
, M.time time_end
, M.duration_pause
, M.type_match_add type_match
, M.type_tournoi_add type_tournament
, '' level
, M.qualif
, M.idw winner_id
, P1.id p1_id
, P1.nom p1_name
, P1.prenom p1_first_name
, P1.name_zh p1_name_zh
, P1.birthday p1_birthday
, P1.sexe p1_gender
, P1.nat p1_nat
, P1.photo p1_photo
, P1.taille p1_height
, P1.poids p1_weight
, R1.rank p1_rank
, R1.liveRank p1_rank_live
, P1.pro_depuis p1_turn_pro
, '?' p1_best_rank
, P1.prise p1_forehand
, P1.revers p1_backhand
, M.ts1 p1_seed
, P1B.id p1b_id
, P1B.nom p1b_name
, P1B.prenom p1b_first_name
, P1B.name_zh p1b_name_zh
, P1B.birthday p1b_birthday
, P1B.sexe p1b_gender
, P1B.nat p1b_nat
, P1B.photo p1b_photo
, P1B.taille p1b_height
, P1B.poids p1b_weight
, R1B.rank p1b_rank
, R1B.liveRank p1b_rank_live
, P1B.pro_depuis p1b_turn_pro
, P2.id p2_id
, P2.nom p2_name
, P2.prenom p2_first_name
, P2.name_zh p2_name_zh
, P2.birthday p2_birthday
, P2.sexe p2_gender
, P2.nat p2_nat
, P2.photo p2_photo
, P2.taille p2_height
, P2.poids p2_weight
, R2.rank p2_rank
, R2.liveRank p2_rank_live
, P2.pro_depuis p2_turn_pro
, '?' p2_best_rank
, P2.prise p2_forehand
, P2.revers p2_backhand
, M.ts2 p2_seed
, P2B.id p2b_id
, P2B.nom p2b_name
, P2B.prenom p2b_first_name
, P2B.name_zh p2b_name_zh
, P2B.birthday p2b_birthday
, P2B.sexe p2b_gender
, P2B.nat p2b_nat
, P2B.photo p2b_photo
, P2B.taille p2b_height
, P2B.poids p2b_weight
, R2B.rank p2b_rank
, R2B.liveRank p2b_rank_live
, P2B.pro_depuis p2b_turn_pro
, L.id tournament_id
, 0 tournament_idt
, LR.id rencontre_id
, N.name_fr tournament_name_fr
, N.name_en tournament_name_en
, N.name_zh tournament_name_zh
, N.name_de tournament_name_de
, N.name_es tournament_name_es
, SC.nom tournament_city
, '' tournament_stadium
, '3' tournament_surface
, '' tournament_surface_photo
, '0' tournament_surface_color
, '' tournament_currency
, '' tournament_prize_money
, SCO.nom_fr tournament_country
, '' tournament_logo
, L.time_start tournament_start
, '' tournament_end
, '' tournament_nbPlayer
, '' tournament_genre
, '' tournament_category
, '' tournament_type
, LR.site tournament_site
, L.year tournament_year
, 0 tournament_importance
, '' team1
, '' team2
, 3 importance
, '' tournament_background
, SC.fuseau_horaire
, IF(ISNULL(LS.status) || M.status = 2 || M.status = 3 || M.status = 4, M.status, LS.status) match_status
, LS.serve
, S.time s_time_start
, S.court
, S.date_loc
, S.type s_type
, S.ordre s_order
, CT.nom court_name
, CT.ordre court_order
FROM
tournois_matchs M
JOIN joueurs P1 on P1.id = M.j1
LEFT JOIN `joueurs` P1B on P1B.id = M.j1_bis
JOIN joueurs P2 on P2.id = M.j2
LEFT JOIN `joueurs` P2B on P2B.id = M.j2_bis
LEFT JOIN tennis_rankings R1 on R1.player = P1.id AND R1.id = IF(P1.sexe = 1, 'wta', 'atp')
LEFT JOIN tennis_rankings R1B on R1B.player = P1B.id AND R1B.id = IF(P1B.sexe = 1, 'wta', 'atp')
LEFT JOIN tennis_rankings R2 on R2.player = P2.id AND R2.id = IF(P2.sexe = 1, 'wta', 'atp')
LEFT JOIN tennis_rankings R2B on R2B.player = P2B.id AND R2B.id = IF(P2B.sexe = 1, 'wta', 'atp')
LEFT JOIN `livescores_new`.`matchs` LS ON (LS.tt_match_id = M.id)
LEFT JOIN tournois_programmes S on S.idm = M.id
LEFT JOIN lieux_courts CT on (CT.ids = S.ids && CT.ordre = S.court)
JOIN `leagues_rounds` LR on LR.id = M.league_round
JOIN `leagues` L on L.id = LR.league
JOIN tournois_name N on N.league = L.id
LEFT JOIN lieux_sites SL on SL.id = LR.site
LEFT JOIN lieux_villes SC on SC.id = SL.idv
LEFT JOIN lieux_pays SCO on SCO.code = SC.pays
WHERE
M.id = '4063818'
&& M.type_tournoi_add = 2
&& (S.statut = 0 || S.statut = 4 || S.statut = 2 || ISNULL(S.statut))
LIMIT 1
SELECT M.*
, M.time_start time_start
, M.time time_end
, M.duration_pause
, M.type_match_add type_match
, M.type_tournoi_add type_tournament
, M.niveau level
, M.qualif
, M.idw winner_id
, P1.id p1_id
, P1.nom p1_name
, P1.prenom p1_first_name
, P1.name_zh p1_name_zh
, P1.birthday p1_birthday
, P1.sexe p1_gender
, P1.nat p1_nat
, P1.photo p1_photo
, P1.taille p1_height
, P1.poids p1_weight
, R1.rank p1_rank
, R1.liveRank p1_rank_live
, P1.pro_depuis p1_turn_pro
, '?' p1_best_rank
, P1.prise p1_forehand
, P1.revers p1_backhand
, M.ts1 p1_seed
, P1B.id p1b_id
, P1B.nom p1b_name
, P1B.prenom p1b_first_name
, P1B.name_zh p1b_name_zh
, P1B.birthday p1b_birthday
, P1B.sexe p1b_gender
, P1B.nat p1b_nat
, P1B.photo p1b_photo
, P1B.taille p1b_height
, P1B.poids p1b_weight
, R1B.rank p1b_rank
, R1B.liveRank p1b_rank_live
, P1B.pro_depuis p1b_turn_pro
, P2.id p2_id
, P2.nom p2_name
, P2.prenom p2_first_name
, P2.name_zh p2_name_zh
, P2.birthday p2_birthday
, P2.sexe p2_gender
, P2.nat p2_nat
, P2.photo p2_photo
, P2.taille p2_height
, P2.poids p2_weight
, R2.rank p2_rank
, R2.liveRank p2_rank_live
, P2.pro_depuis p2_turn_pro
, '?' p2_best_rank
, P2.prise p2_forehand
, P2.revers p2_backhand
, M.ts2 p2_seed
, P2B.id p2b_id
, P2B.nom p2b_name
, P2B.prenom p2b_first_name
, P2B.name_zh p2b_name_zh
, P2B.birthday p2b_birthday
, P2B.sexe p2b_gender
, P2B.nat p2b_nat
, P2B.photo p2b_photo
, P2B.taille p2b_height
, P2B.poids p2b_weight
, R2B.rank p2b_rank
, R2B.liveRank p2b_rank_live
, P2B.pro_depuis p2b_turn_pro
, T.id tournament_id
, T.idt tournament_idt
, '?' rencontre_id
, N.name_fr tournament_name_fr
, N.name_en tournament_name_en
, N.name_zh tournament_name_zh
, N.name_de tournament_name_de
, N.name_es tournament_name_es
, T.ville tournament_city
, T.stade tournament_stadium
, T.surface tournament_surface
, T.surface_photo tournament_surface_photo
, T.surface_color tournament_surface_color
, T.monnaie tournament_currency
, T.prix tournament_prize_money
, SCO.nom_fr tournament_country
, T.logo tournament_logo
, T.debut tournament_start
, T.fin tournament_end
, T.nbj tournament_nbPlayer
, T.genre tournament_genre
, T.category tournament_category
, T.type tournament_type
, T.ids tournament_site
, T.year tournament_year
, T.importance tournament_importance
, '' team1
, '' team2
, T.importance
, T.background tournament_background
, SC.fuseau_horaire
, IF(ISNULL(LS.status) || M.status = 2 || M.status = 3 || M.status = 4, M.status, LS.status) match_status
, LS.serve
, S.time s_time_start
, S.court
, S.date_loc
, S.type s_type
, S.ordre s_order
, C.nom court_name
, C.ordre court_order
FROM
tournois_matchs M
INNER JOIN joueurs P1 on P1.id = M.j1
LEFT OUTER JOIN `joueurs` P1B on P1B.id = M.j1_bis
INNER JOIN joueurs P2 on P2.id = M.j2
LEFT OUTER JOIN `joueurs` P2B on P2B.id = M.j2_bis
LEFT JOIN tennis_rankings R1 on R1.player = P1.id AND R1.id = IF(P1.sexe = 1, 'wta', 'atp')
LEFT JOIN tennis_rankings R1B on R1B.player = P1B.id AND R1B.id = IF(P1B.sexe = 1, 'wta', 'atp')
LEFT JOIN tennis_rankings R2 on R2.player = P2.id AND R2.id = IF(P2.sexe = 1, 'wta', 'atp')
LEFT JOIN tennis_rankings R2B on R2B.player = P2B.id AND R2B.id = IF(P2B.sexe = 1, 'wta', 'atp')
INNER JOIN tournois T on T.id = M.idt
INNER JOIN tournois_name N on N.id = T.id && N.cup = 0
LEFT OUTER JOIN lieux_sites SL on T.ids = SL.id
LEFT OUTER JOIN lieux_villes SC on SL.idv = SC.id
LEFT OUTER JOIN lieux_pays SCO on SCO.code = SC.pays
LEFT OUTER JOIN `livescores_new`.`matchs` LS on LS.tt_match_id = M.id
LEFT OUTER JOIN tournois_programmes S on S.idm = M.id
LEFT OUTER JOIN lieux_courts C on C.ids = S.ids && C.ordre = S.court
WHERE
M.id = '4063825'
&& M.type_tournoi_add = 0
&& (S.statut = 0 || S.statut = 4 || S.statut = 2 || ISNULL(S.statut))
UNION
SELECT
M.*
, M.time_start time_start
, M.time time_end
, M.duration_pause
, M.type_match_add type_match
, M.type_tournoi_add type_tournament
, CR.niveau level
, M.qualif
, M.idw winner_id
, P1.id p1_id
, P1.nom p1_name
, P1.prenom p1_first_name
, P1.name_zh p1_name_zh
, P1.birthday p1_birthday
, P1.sexe p1_gender
, P1.nat p1_nat
, P1.photo p1_photo
, P1.taille p1_height
, P1.poids p1_weight
, R1.rank p1_rank
, R1.liveRank p1_rank_live
, P1.pro_depuis p1_turn_pro
, '?' p1_best_rank
, P1.prise p1_forehand
, P1.revers p1_backhand
, M.ts1 p1_seed
, P1B.id p1b_id
, P1B.nom p1b_name
, P1B.prenom p1b_first_name
, P1B.name_zh p1b_name_zh
, P1B.birthday p1b_birthday
, P1B.sexe p1b_gender
, P1B.nat p1b_nat
, P1B.photo p1b_photo
, P1B.taille p1b_height
, P1B.poids p1b_weight
, R1B.rank p1b_rank
, R1B.liveRank p1b_rank_live
, P1B.pro_depuis p1b_turn_pro
, P2.id p2_id
, P2.nom p2_name
, P2.prenom p2_first_name
, P2.name_zh p2_name_zh
, P2.birthday p2_birthday
, P2.sexe p2_gender
, P2.nat p2_nat
, P2.photo p2_photo
, P2.taille p2_height
, P2.poids p2_weight
, R2.rank p2_rank
, R2.liveRank p2_rank_live
, P2.pro_depuis p2_turn_pro
, '?' p2_best_rank
, P2.prise p2_forehand
, P2.revers p2_backhand
, M.ts2 p2_seed
, P2B.id p2b_id
, P2B.nom p2b_name
, P2B.prenom p2b_first_name
, P2B.name_zh p2b_name_zh
, P2B.birthday p2b_birthday
, P2B.sexe p2b_gender
, P2B.nat p2b_nat
, P2B.photo p2b_photo
, P2B.taille p2b_height
, P2B.poids p2b_weight
, R2B.rank p2b_rank
, R2B.liveRank p2b_rank_live
, P2B.pro_depuis p2b_turn_pro
, C.id tournament_id
, C.parent tournament_idt
, CR.id rencontre_id
, N.name_fr tournament_name_fr
, N.name_en tournament_name_en
, N.name_zh tournament_name_zh
, N.name_de tournament_name_de
, N.name_es tournament_name_es
, CONCAT(CR.equipe_domicile, '|', CR.equipe_exterieur) tournament_city
, '' tournament_stadium
, CR.surface tournament_surface
, '' tournament_surface_photo
, '0' tournament_surface_color
, '' tournament_currency
, '' tournament_prize_money
, SCO.nom_fr tournament_country
, '' tournament_logo
, CR.date_d tournament_start
, '' tournament_end
, C.nbj tournament_nbPlayer
, '' tournament_genre
, '' tournament_category
, '' tournament_type
, CR.lieu tournament_site
, '' tournament_year
, 65 tournament_importance
, IF(T1.nom_fr, T1.nom_fr, CR.equipe_domicile) team1
, IF(T2.nom_fr, T1.nom_fr, CR.equipe_exterieur) team2
, 65 importance
, '' tournament_background
, SC.fuseau_horaire
, IF(ISNULL(LS.status) || M.status = 2 || M.status = 3 || M.status = 4, M.status, LS.status) match_status
, LS.serve
, S.time s_time_start
, S.court
, S.date_loc
, S.type s_type
, S.ordre s_order
, CT.nom court_name
, CT.ordre court_order
FROM
tournois_matchs M
INNER JOIN joueurs P1 on P1.id = M.j1
LEFT OUTER JOIN `joueurs` P1B on P1B.id = M.j1_bis
INNER JOIN joueurs P2 on P2.id = M.j2
LEFT OUTER JOIN `joueurs` P2B on P2B.id = M.j2_bis
LEFT JOIN tennis_rankings R1 on R1.player = P1.id AND R1.id = IF(P1.sexe = 1, 'wta', 'atp')
LEFT JOIN tennis_rankings R1B on R1B.player = P1B.id AND R1B.id = IF(P1B.sexe = 1, 'wta', 'atp')
LEFT JOIN tennis_rankings R2 on R2.player = P2.id AND R2.id = IF(P2.sexe = 1, 'wta', 'atp')
LEFT JOIN tennis_rankings R2B on R2B.player = P2B.id AND R2B.id = IF(P2B.sexe = 1, 'wta', 'atp')
LEFT OUTER JOIN `livescores_new`.`matchs` LS ON (LS.tt_match_id = M.id)
LEFT OUTER JOIN tournois_programmes S on S.idm = M.id
LEFT OUTER JOIN lieux_courts CT on (CT.ids = S.ids && CT.ordre = S.court)
INNER JOIN `coupes_rencontres` CR on CR.id = M.idt
INNER JOIN `coupes` C on C.id = CR.coupe_id
INNER JOIN tournois_name N on N.id = C.id
LEFT JOIN lieux_sites SL on SL.id = CR.lieu
LEFT JOIN lieux_villes SC on SC.id = SL.idv
LEFT JOIN lieux_pays SCO on SCO.code = SC.pays
LEFT JOIN `lieux_pays` T1 ON (T1.code = CR.equipe_domicile)
LEFT JOIN `lieux_pays` T2 ON (T2.code = CR.equipe_exterieur)
WHERE
M.id = '4063825'
&& M.type_tournoi_add = 1
&& (S.statut = 0 || S.statut = 4 || S.statut = 2 || ISNULL(S.statut))
UNION
SELECT
M.*
, M.time_start time_start
, M.time time_end
, M.duration_pause
, M.type_match_add type_match
, M.type_tournoi_add type_tournament
, '' level
, M.qualif
, M.idw winner_id
, P1.id p1_id
, P1.nom p1_name
, P1.prenom p1_first_name
, P1.name_zh p1_name_zh
, P1.birthday p1_birthday
, P1.sexe p1_gender
, P1.nat p1_nat
, P1.photo p1_photo
, P1.taille p1_height
, P1.poids p1_weight
, R1.rank p1_rank
, R1.liveRank p1_rank_live
, P1.pro_depuis p1_turn_pro
, '?' p1_best_rank
, P1.prise p1_forehand
, P1.revers p1_backhand
, M.ts1 p1_seed
, P1B.id p1b_id
, P1B.nom p1b_name
, P1B.prenom p1b_first_name
, P1B.name_zh p1b_name_zh
, P1B.birthday p1b_birthday
, P1B.sexe p1b_gender
, P1B.nat p1b_nat
, P1B.photo p1b_photo
, P1B.taille p1b_height
, P1B.poids p1b_weight
, R1B.rank p1b_rank
, R1B.liveRank p1b_rank_live
, P1B.pro_depuis p1b_turn_pro
, P2.id p2_id
, P2.nom p2_name
, P2.prenom p2_first_name
, P2.name_zh p2_name_zh
, P2.birthday p2_birthday
, P2.sexe p2_gender
, P2.nat p2_nat
, P2.photo p2_photo
, P2.taille p2_height
, P2.poids p2_weight
, R2.rank p2_rank
, R2.liveRank p2_rank_live
, P2.pro_depuis p2_turn_pro
, '?' p2_best_rank
, P2.prise p2_forehand
, P2.revers p2_backhand
, M.ts2 p2_seed
, P2B.id p2b_id
, P2B.nom p2b_name
, P2B.prenom p2b_first_name
, P2B.name_zh p2b_name_zh
, P2B.birthday p2b_birthday
, P2B.sexe p2b_gender
, P2B.nat p2b_nat
, P2B.photo p2b_photo
, P2B.taille p2b_height
, P2B.poids p2b_weight
, R2B.rank p2b_rank
, R2B.liveRank p2b_rank_live
, P2B.pro_depuis p2b_turn_pro
, L.id tournament_id
, 0 tournament_idt
, LR.id rencontre_id
, N.name_fr tournament_name_fr
, N.name_en tournament_name_en
, N.name_zh tournament_name_zh
, N.name_de tournament_name_de
, N.name_es tournament_name_es
, SC.nom tournament_city
, '' tournament_stadium
, '3' tournament_surface
, '' tournament_surface_photo
, '0' tournament_surface_color
, '' tournament_currency
, '' tournament_prize_money
, SCO.nom_fr tournament_country
, '' tournament_logo
, L.time_start tournament_start
, '' tournament_end
, '' tournament_nbPlayer
, '' tournament_genre
, '' tournament_category
, '' tournament_type
, LR.site tournament_site
, L.year tournament_year
, 0 tournament_importance
, '' team1
, '' team2
, 3 importance
, '' tournament_background
, SC.fuseau_horaire
, IF(ISNULL(LS.status) || M.status = 2 || M.status = 3 || M.status = 4, M.status, LS.status) match_status
, LS.serve
, S.time s_time_start
, S.court
, S.date_loc
, S.type s_type
, S.ordre s_order
, CT.nom court_name
, CT.ordre court_order
FROM
tournois_matchs M
JOIN joueurs P1 on P1.id = M.j1
LEFT JOIN `joueurs` P1B on P1B.id = M.j1_bis
JOIN joueurs P2 on P2.id = M.j2
LEFT JOIN `joueurs` P2B on P2B.id = M.j2_bis
LEFT JOIN tennis_rankings R1 on R1.player = P1.id AND R1.id = IF(P1.sexe = 1, 'wta', 'atp')
LEFT JOIN tennis_rankings R1B on R1B.player = P1B.id AND R1B.id = IF(P1B.sexe = 1, 'wta', 'atp')
LEFT JOIN tennis_rankings R2 on R2.player = P2.id AND R2.id = IF(P2.sexe = 1, 'wta', 'atp')
LEFT JOIN tennis_rankings R2B on R2B.player = P2B.id AND R2B.id = IF(P2B.sexe = 1, 'wta', 'atp')
LEFT JOIN `livescores_new`.`matchs` LS ON (LS.tt_match_id = M.id)
LEFT JOIN tournois_programmes S on S.idm = M.id
LEFT JOIN lieux_courts CT on (CT.ids = S.ids && CT.ordre = S.court)
JOIN `leagues_rounds` LR on LR.id = M.league_round
JOIN `leagues` L on L.id = LR.league
JOIN tournois_name N on N.league = L.id
LEFT JOIN lieux_sites SL on SL.id = LR.site
LEFT JOIN lieux_villes SC on SC.id = SL.idv
LEFT JOIN lieux_pays SCO on SCO.code = SC.pays
WHERE
M.id = '4063825'
&& M.type_tournoi_add = 2
&& (S.statut = 0 || S.statut = 4 || S.statut = 2 || ISNULL(S.statut))
LIMIT 1
SELECT M.*
, M.time_start time_start
, M.time time_end
, M.duration_pause
, M.type_match_add type_match
, M.type_tournoi_add type_tournament
, M.niveau level
, M.qualif
, M.idw winner_id
, P1.id p1_id
, P1.nom p1_name
, P1.prenom p1_first_name
, P1.name_zh p1_name_zh
, P1.birthday p1_birthday
, P1.sexe p1_gender
, P1.nat p1_nat
, P1.photo p1_photo
, P1.taille p1_height
, P1.poids p1_weight
, R1.rank p1_rank
, R1.liveRank p1_rank_live
, P1.pro_depuis p1_turn_pro
, '?' p1_best_rank
, P1.prise p1_forehand
, P1.revers p1_backhand
, M.ts1 p1_seed
, P1B.id p1b_id
, P1B.nom p1b_name
, P1B.prenom p1b_first_name
, P1B.name_zh p1b_name_zh
, P1B.birthday p1b_birthday
, P1B.sexe p1b_gender
, P1B.nat p1b_nat
, P1B.photo p1b_photo
, P1B.taille p1b_height
, P1B.poids p1b_weight
, R1B.rank p1b_rank
, R1B.liveRank p1b_rank_live
, P1B.pro_depuis p1b_turn_pro
, P2.id p2_id
, P2.nom p2_name
, P2.prenom p2_first_name
, P2.name_zh p2_name_zh
, P2.birthday p2_birthday
, P2.sexe p2_gender
, P2.nat p2_nat
, P2.photo p2_photo
, P2.taille p2_height
, P2.poids p2_weight
, R2.rank p2_rank
, R2.liveRank p2_rank_live
, P2.pro_depuis p2_turn_pro
, '?' p2_best_rank
, P2.prise p2_forehand
, P2.revers p2_backhand
, M.ts2 p2_seed
, P2B.id p2b_id
, P2B.nom p2b_name
, P2B.prenom p2b_first_name
, P2B.name_zh p2b_name_zh
, P2B.birthday p2b_birthday
, P2B.sexe p2b_gender
, P2B.nat p2b_nat
, P2B.photo p2b_photo
, P2B.taille p2b_height
, P2B.poids p2b_weight
, R2B.rank p2b_rank
, R2B.liveRank p2b_rank_live
, P2B.pro_depuis p2b_turn_pro
, T.id tournament_id
, T.idt tournament_idt
, '?' rencontre_id
, N.name_fr tournament_name_fr
, N.name_en tournament_name_en
, N.name_zh tournament_name_zh
, N.name_de tournament_name_de
, N.name_es tournament_name_es
, T.ville tournament_city
, T.stade tournament_stadium
, T.surface tournament_surface
, T.surface_photo tournament_surface_photo
, T.surface_color tournament_surface_color
, T.monnaie tournament_currency
, T.prix tournament_prize_money
, SCO.nom_fr tournament_country
, T.logo tournament_logo
, T.debut tournament_start
, T.fin tournament_end
, T.nbj tournament_nbPlayer
, T.genre tournament_genre
, T.category tournament_category
, T.type tournament_type
, T.ids tournament_site
, T.year tournament_year
, T.importance tournament_importance
, '' team1
, '' team2
, T.importance
, T.background tournament_background
, SC.fuseau_horaire
, IF(ISNULL(LS.status) || M.status = 2 || M.status = 3 || M.status = 4, M.status, LS.status) match_status
, LS.serve
, S.time s_time_start
, S.court
, S.date_loc
, S.type s_type
, S.ordre s_order
, C.nom court_name
, C.ordre court_order
FROM
tournois_matchs M
INNER JOIN joueurs P1 on P1.id = M.j1
LEFT OUTER JOIN `joueurs` P1B on P1B.id = M.j1_bis
INNER JOIN joueurs P2 on P2.id = M.j2
LEFT OUTER JOIN `joueurs` P2B on P2B.id = M.j2_bis
LEFT JOIN tennis_rankings R1 on R1.player = P1.id AND R1.id = IF(P1.sexe = 1, 'wta', 'atp')
LEFT JOIN tennis_rankings R1B on R1B.player = P1B.id AND R1B.id = IF(P1B.sexe = 1, 'wta', 'atp')
LEFT JOIN tennis_rankings R2 on R2.player = P2.id AND R2.id = IF(P2.sexe = 1, 'wta', 'atp')
LEFT JOIN tennis_rankings R2B on R2B.player = P2B.id AND R2B.id = IF(P2B.sexe = 1, 'wta', 'atp')
INNER JOIN tournois T on T.id = M.idt
INNER JOIN tournois_name N on N.id = T.id && N.cup = 0
LEFT OUTER JOIN lieux_sites SL on T.ids = SL.id
LEFT OUTER JOIN lieux_villes SC on SL.idv = SC.id
LEFT OUTER JOIN lieux_pays SCO on SCO.code = SC.pays
LEFT OUTER JOIN `livescores_new`.`matchs` LS on LS.tt_match_id = M.id
LEFT OUTER JOIN tournois_programmes S on S.idm = M.id
LEFT OUTER JOIN lieux_courts C on C.ids = S.ids && C.ordre = S.court
WHERE
M.id = '4063822'
&& M.type_tournoi_add = 0
&& (S.statut = 0 || S.statut = 4 || S.statut = 2 || ISNULL(S.statut))
UNION
SELECT
M.*
, M.time_start time_start
, M.time time_end
, M.duration_pause
, M.type_match_add type_match
, M.type_tournoi_add type_tournament
, CR.niveau level
, M.qualif
, M.idw winner_id
, P1.id p1_id
, P1.nom p1_name
, P1.prenom p1_first_name
, P1.name_zh p1_name_zh
, P1.birthday p1_birthday
, P1.sexe p1_gender
, P1.nat p1_nat
, P1.photo p1_photo
, P1.taille p1_height
, P1.poids p1_weight
, R1.rank p1_rank
, R1.liveRank p1_rank_live
, P1.pro_depuis p1_turn_pro
, '?' p1_best_rank
, P1.prise p1_forehand
, P1.revers p1_backhand
, M.ts1 p1_seed
, P1B.id p1b_id
, P1B.nom p1b_name
, P1B.prenom p1b_first_name
, P1B.name_zh p1b_name_zh
, P1B.birthday p1b_birthday
, P1B.sexe p1b_gender
, P1B.nat p1b_nat
, P1B.photo p1b_photo
, P1B.taille p1b_height
, P1B.poids p1b_weight
, R1B.rank p1b_rank
, R1B.liveRank p1b_rank_live
, P1B.pro_depuis p1b_turn_pro
, P2.id p2_id
, P2.nom p2_name
, P2.prenom p2_first_name
, P2.name_zh p2_name_zh
, P2.birthday p2_birthday
, P2.sexe p2_gender
, P2.nat p2_nat
, P2.photo p2_photo
, P2.taille p2_height
, P2.poids p2_weight
, R2.rank p2_rank
, R2.liveRank p2_rank_live
, P2.pro_depuis p2_turn_pro
, '?' p2_best_rank
, P2.prise p2_forehand
, P2.revers p2_backhand
, M.ts2 p2_seed
, P2B.id p2b_id
, P2B.nom p2b_name
, P2B.prenom p2b_first_name
, P2B.name_zh p2b_name_zh
, P2B.birthday p2b_birthday
, P2B.sexe p2b_gender
, P2B.nat p2b_nat
, P2B.photo p2b_photo
, P2B.taille p2b_height
, P2B.poids p2b_weight
, R2B.rank p2b_rank
, R2B.liveRank p2b_rank_live
, P2B.pro_depuis p2b_turn_pro
, C.id tournament_id
, C.parent tournament_idt
, CR.id rencontre_id
, N.name_fr tournament_name_fr
, N.name_en tournament_name_en
, N.name_zh tournament_name_zh
, N.name_de tournament_name_de
, N.name_es tournament_name_es
, CONCAT(CR.equipe_domicile, '|', CR.equipe_exterieur) tournament_city
, '' tournament_stadium
, CR.surface tournament_surface
, '' tournament_surface_photo
, '0' tournament_surface_color
, '' tournament_currency
, '' tournament_prize_money
, SCO.nom_fr tournament_country
, '' tournament_logo
, CR.date_d tournament_start
, '' tournament_end
, C.nbj tournament_nbPlayer
, '' tournament_genre
, '' tournament_category
, '' tournament_type
, CR.lieu tournament_site
, '' tournament_year
, 65 tournament_importance
, IF(T1.nom_fr, T1.nom_fr, CR.equipe_domicile) team1
, IF(T2.nom_fr, T1.nom_fr, CR.equipe_exterieur) team2
, 65 importance
, '' tournament_background
, SC.fuseau_horaire
, IF(ISNULL(LS.status) || M.status = 2 || M.status = 3 || M.status = 4, M.status, LS.status) match_status
, LS.serve
, S.time s_time_start
, S.court
, S.date_loc
, S.type s_type
, S.ordre s_order
, CT.nom court_name
, CT.ordre court_order
FROM
tournois_matchs M
INNER JOIN joueurs P1 on P1.id = M.j1
LEFT OUTER JOIN `joueurs` P1B on P1B.id = M.j1_bis
INNER JOIN joueurs P2 on P2.id = M.j2
LEFT OUTER JOIN `joueurs` P2B on P2B.id = M.j2_bis
LEFT JOIN tennis_rankings R1 on R1.player = P1.id AND R1.id = IF(P1.sexe = 1, 'wta', 'atp')
LEFT JOIN tennis_rankings R1B on R1B.player = P1B.id AND R1B.id = IF(P1B.sexe = 1, 'wta', 'atp')
LEFT JOIN tennis_rankings R2 on R2.player = P2.id AND R2.id = IF(P2.sexe = 1, 'wta', 'atp')
LEFT JOIN tennis_rankings R2B on R2B.player = P2B.id AND R2B.id = IF(P2B.sexe = 1, 'wta', 'atp')
LEFT OUTER JOIN `livescores_new`.`matchs` LS ON (LS.tt_match_id = M.id)
LEFT OUTER JOIN tournois_programmes S on S.idm = M.id
LEFT OUTER JOIN lieux_courts CT on (CT.ids = S.ids && CT.ordre = S.court)
INNER JOIN `coupes_rencontres` CR on CR.id = M.idt
INNER JOIN `coupes` C on C.id = CR.coupe_id
INNER JOIN tournois_name N on N.id = C.id
LEFT JOIN lieux_sites SL on SL.id = CR.lieu
LEFT JOIN lieux_villes SC on SC.id = SL.idv
LEFT JOIN lieux_pays SCO on SCO.code = SC.pays
LEFT JOIN `lieux_pays` T1 ON (T1.code = CR.equipe_domicile)
LEFT JOIN `lieux_pays` T2 ON (T2.code = CR.equipe_exterieur)
WHERE
M.id = '4063822'
&& M.type_tournoi_add = 1
&& (S.statut = 0 || S.statut = 4 || S.statut = 2 || ISNULL(S.statut))
UNION
SELECT
M.*
, M.time_start time_start
, M.time time_end
, M.duration_pause
, M.type_match_add type_match
, M.type_tournoi_add type_tournament
, '' level
, M.qualif
, M.idw winner_id
, P1.id p1_id
, P1.nom p1_name
, P1.prenom p1_first_name
, P1.name_zh p1_name_zh
, P1.birthday p1_birthday
, P1.sexe p1_gender
, P1.nat p1_nat
, P1.photo p1_photo
, P1.taille p1_height
, P1.poids p1_weight
, R1.rank p1_rank
, R1.liveRank p1_rank_live
, P1.pro_depuis p1_turn_pro
, '?' p1_best_rank
, P1.prise p1_forehand
, P1.revers p1_backhand
, M.ts1 p1_seed
, P1B.id p1b_id
, P1B.nom p1b_name
, P1B.prenom p1b_first_name
, P1B.name_zh p1b_name_zh
, P1B.birthday p1b_birthday
, P1B.sexe p1b_gender
, P1B.nat p1b_nat
, P1B.photo p1b_photo
, P1B.taille p1b_height
, P1B.poids p1b_weight
, R1B.rank p1b_rank
, R1B.liveRank p1b_rank_live
, P1B.pro_depuis p1b_turn_pro
, P2.id p2_id
, P2.nom p2_name
, P2.prenom p2_first_name
, P2.name_zh p2_name_zh
, P2.birthday p2_birthday
, P2.sexe p2_gender
, P2.nat p2_nat
, P2.photo p2_photo
, P2.taille p2_height
, P2.poids p2_weight
, R2.rank p2_rank
, R2.liveRank p2_rank_live
, P2.pro_depuis p2_turn_pro
, '?' p2_best_rank
, P2.prise p2_forehand
, P2.revers p2_backhand
, M.ts2 p2_seed
, P2B.id p2b_id
, P2B.nom p2b_name
, P2B.prenom p2b_first_name
, P2B.name_zh p2b_name_zh
, P2B.birthday p2b_birthday
, P2B.sexe p2b_gender
, P2B.nat p2b_nat
, P2B.photo p2b_photo
, P2B.taille p2b_height
, P2B.poids p2b_weight
, R2B.rank p2b_rank
, R2B.liveRank p2b_rank_live
, P2B.pro_depuis p2b_turn_pro
, L.id tournament_id
, 0 tournament_idt
, LR.id rencontre_id
, N.name_fr tournament_name_fr
, N.name_en tournament_name_en
, N.name_zh tournament_name_zh
, N.name_de tournament_name_de
, N.name_es tournament_name_es
, SC.nom tournament_city
, '' tournament_stadium
, '3' tournament_surface
, '' tournament_surface_photo
, '0' tournament_surface_color
, '' tournament_currency
, '' tournament_prize_money
, SCO.nom_fr tournament_country
, '' tournament_logo
, L.time_start tournament_start
, '' tournament_end
, '' tournament_nbPlayer
, '' tournament_genre
, '' tournament_category
, '' tournament_type
, LR.site tournament_site
, L.year tournament_year
, 0 tournament_importance
, '' team1
, '' team2
, 3 importance
, '' tournament_background
, SC.fuseau_horaire
, IF(ISNULL(LS.status) || M.status = 2 || M.status = 3 || M.status = 4, M.status, LS.status) match_status
, LS.serve
, S.time s_time_start
, S.court
, S.date_loc
, S.type s_type
, S.ordre s_order
, CT.nom court_name
, CT.ordre court_order
FROM
tournois_matchs M
JOIN joueurs P1 on P1.id = M.j1
LEFT JOIN `joueurs` P1B on P1B.id = M.j1_bis
JOIN joueurs P2 on P2.id = M.j2
LEFT JOIN `joueurs` P2B on P2B.id = M.j2_bis
LEFT JOIN tennis_rankings R1 on R1.player = P1.id AND R1.id = IF(P1.sexe = 1, 'wta', 'atp')
LEFT JOIN tennis_rankings R1B on R1B.player = P1B.id AND R1B.id = IF(P1B.sexe = 1, 'wta', 'atp')
LEFT JOIN tennis_rankings R2 on R2.player = P2.id AND R2.id = IF(P2.sexe = 1, 'wta', 'atp')
LEFT JOIN tennis_rankings R2B on R2B.player = P2B.id AND R2B.id = IF(P2B.sexe = 1, 'wta', 'atp')
LEFT JOIN `livescores_new`.`matchs` LS ON (LS.tt_match_id = M.id)
LEFT JOIN tournois_programmes S on S.idm = M.id
LEFT JOIN lieux_courts CT on (CT.ids = S.ids && CT.ordre = S.court)
JOIN `leagues_rounds` LR on LR.id = M.league_round
JOIN `leagues` L on L.id = LR.league
JOIN tournois_name N on N.league = L.id
LEFT JOIN lieux_sites SL on SL.id = LR.site
LEFT JOIN lieux_villes SC on SC.id = SL.idv
LEFT JOIN lieux_pays SCO on SCO.code = SC.pays
WHERE
M.id = '4063822'
&& M.type_tournoi_add = 2
&& (S.statut = 0 || S.statut = 4 || S.statut = 2 || ISNULL(S.statut))
LIMIT 1
SELECT M.*
, M.time_start time_start
, M.time time_end
, M.duration_pause
, M.type_match_add type_match
, M.type_tournoi_add type_tournament
, M.niveau level
, M.qualif
, M.idw winner_id
, P1.id p1_id
, P1.nom p1_name
, P1.prenom p1_first_name
, P1.name_zh p1_name_zh
, P1.birthday p1_birthday
, P1.sexe p1_gender
, P1.nat p1_nat
, P1.photo p1_photo
, P1.taille p1_height
, P1.poids p1_weight
, R1.rank p1_rank
, R1.liveRank p1_rank_live
, P1.pro_depuis p1_turn_pro
, '?' p1_best_rank
, P1.prise p1_forehand
, P1.revers p1_backhand
, M.ts1 p1_seed
, P1B.id p1b_id
, P1B.nom p1b_name
, P1B.prenom p1b_first_name
, P1B.name_zh p1b_name_zh
, P1B.birthday p1b_birthday
, P1B.sexe p1b_gender
, P1B.nat p1b_nat
, P1B.photo p1b_photo
, P1B.taille p1b_height
, P1B.poids p1b_weight
, R1B.rank p1b_rank
, R1B.liveRank p1b_rank_live
, P1B.pro_depuis p1b_turn_pro
, P2.id p2_id
, P2.nom p2_name
, P2.prenom p2_first_name
, P2.name_zh p2_name_zh
, P2.birthday p2_birthday
, P2.sexe p2_gender
, P2.nat p2_nat
, P2.photo p2_photo
, P2.taille p2_height
, P2.poids p2_weight
, R2.rank p2_rank
, R2.liveRank p2_rank_live
, P2.pro_depuis p2_turn_pro
, '?' p2_best_rank
, P2.prise p2_forehand
, P2.revers p2_backhand
, M.ts2 p2_seed
, P2B.id p2b_id
, P2B.nom p2b_name
, P2B.prenom p2b_first_name
, P2B.name_zh p2b_name_zh
, P2B.birthday p2b_birthday
, P2B.sexe p2b_gender
, P2B.nat p2b_nat
, P2B.photo p2b_photo
, P2B.taille p2b_height
, P2B.poids p2b_weight
, R2B.rank p2b_rank
, R2B.liveRank p2b_rank_live
, P2B.pro_depuis p2b_turn_pro
, T.id tournament_id
, T.idt tournament_idt
, '?' rencontre_id
, N.name_fr tournament_name_fr
, N.name_en tournament_name_en
, N.name_zh tournament_name_zh
, N.name_de tournament_name_de
, N.name_es tournament_name_es
, T.ville tournament_city
, T.stade tournament_stadium
, T.surface tournament_surface
, T.surface_photo tournament_surface_photo
, T.surface_color tournament_surface_color
, T.monnaie tournament_currency
, T.prix tournament_prize_money
, SCO.nom_fr tournament_country
, T.logo tournament_logo
, T.debut tournament_start
, T.fin tournament_end
, T.nbj tournament_nbPlayer
, T.genre tournament_genre
, T.category tournament_category
, T.type tournament_type
, T.ids tournament_site
, T.year tournament_year
, T.importance tournament_importance
, '' team1
, '' team2
, T.importance
, T.background tournament_background
, SC.fuseau_horaire
, IF(ISNULL(LS.status) || M.status = 2 || M.status = 3 || M.status = 4, M.status, LS.status) match_status
, LS.serve
, S.time s_time_start
, S.court
, S.date_loc
, S.type s_type
, S.ordre s_order
, C.nom court_name
, C.ordre court_order
FROM
tournois_matchs M
INNER JOIN joueurs P1 on P1.id = M.j1
LEFT OUTER JOIN `joueurs` P1B on P1B.id = M.j1_bis
INNER JOIN joueurs P2 on P2.id = M.j2
LEFT OUTER JOIN `joueurs` P2B on P2B.id = M.j2_bis
LEFT JOIN tennis_rankings R1 on R1.player = P1.id AND R1.id = IF(P1.sexe = 1, 'wta', 'atp')
LEFT JOIN tennis_rankings R1B on R1B.player = P1B.id AND R1B.id = IF(P1B.sexe = 1, 'wta', 'atp')
LEFT JOIN tennis_rankings R2 on R2.player = P2.id AND R2.id = IF(P2.sexe = 1, 'wta', 'atp')
LEFT JOIN tennis_rankings R2B on R2B.player = P2B.id AND R2B.id = IF(P2B.sexe = 1, 'wta', 'atp')
INNER JOIN tournois T on T.id = M.idt
INNER JOIN tournois_name N on N.id = T.id && N.cup = 0
LEFT OUTER JOIN lieux_sites SL on T.ids = SL.id
LEFT OUTER JOIN lieux_villes SC on SL.idv = SC.id
LEFT OUTER JOIN lieux_pays SCO on SCO.code = SC.pays
LEFT OUTER JOIN `livescores_new`.`matchs` LS on LS.tt_match_id = M.id
LEFT OUTER JOIN tournois_programmes S on S.idm = M.id
LEFT OUTER JOIN lieux_courts C on C.ids = S.ids && C.ordre = S.court
WHERE
M.id = '4063809'
&& M.type_tournoi_add = 0
&& (S.statut = 0 || S.statut = 4 || S.statut = 2 || ISNULL(S.statut))
UNION
SELECT
M.*
, M.time_start time_start
, M.time time_end
, M.duration_pause
, M.type_match_add type_match
, M.type_tournoi_add type_tournament
, CR.niveau level
, M.qualif
, M.idw winner_id
, P1.id p1_id
, P1.nom p1_name
, P1.prenom p1_first_name
, P1.name_zh p1_name_zh
, P1.birthday p1_birthday
, P1.sexe p1_gender
, P1.nat p1_nat
, P1.photo p1_photo
, P1.taille p1_height
, P1.poids p1_weight
, R1.rank p1_rank
, R1.liveRank p1_rank_live
, P1.pro_depuis p1_turn_pro
, '?' p1_best_rank
, P1.prise p1_forehand
, P1.revers p1_backhand
, M.ts1 p1_seed
, P1B.id p1b_id
, P1B.nom p1b_name
, P1B.prenom p1b_first_name
, P1B.name_zh p1b_name_zh
, P1B.birthday p1b_birthday
, P1B.sexe p1b_gender
, P1B.nat p1b_nat
, P1B.photo p1b_photo
, P1B.taille p1b_height
, P1B.poids p1b_weight
, R1B.rank p1b_rank
, R1B.liveRank p1b_rank_live
, P1B.pro_depuis p1b_turn_pro
, P2.id p2_id
, P2.nom p2_name
, P2.prenom p2_first_name
, P2.name_zh p2_name_zh
, P2.birthday p2_birthday
, P2.sexe p2_gender
, P2.nat p2_nat
, P2.photo p2_photo
, P2.taille p2_height
, P2.poids p2_weight
, R2.rank p2_rank
, R2.liveRank p2_rank_live
, P2.pro_depuis p2_turn_pro
, '?' p2_best_rank
, P2.prise p2_forehand
, P2.revers p2_backhand
, M.ts2 p2_seed
, P2B.id p2b_id
, P2B.nom p2b_name
, P2B.prenom p2b_first_name
, P2B.name_zh p2b_name_zh
, P2B.birthday p2b_birthday
, P2B.sexe p2b_gender
, P2B.nat p2b_nat
, P2B.photo p2b_photo
, P2B.taille p2b_height
, P2B.poids p2b_weight
, R2B.rank p2b_rank
, R2B.liveRank p2b_rank_live
, P2B.pro_depuis p2b_turn_pro
, C.id tournament_id
, C.parent tournament_idt
, CR.id rencontre_id
, N.name_fr tournament_name_fr
, N.name_en tournament_name_en
, N.name_zh tournament_name_zh
, N.name_de tournament_name_de
, N.name_es tournament_name_es
, CONCAT(CR.equipe_domicile, '|', CR.equipe_exterieur) tournament_city
, '' tournament_stadium
, CR.surface tournament_surface
, '' tournament_surface_photo
, '0' tournament_surface_color
, '' tournament_currency
, '' tournament_prize_money
, SCO.nom_fr tournament_country
, '' tournament_logo
, CR.date_d tournament_start
, '' tournament_end
, C.nbj tournament_nbPlayer
, '' tournament_genre
, '' tournament_category
, '' tournament_type
, CR.lieu tournament_site
, '' tournament_year
, 65 tournament_importance
, IF(T1.nom_fr, T1.nom_fr, CR.equipe_domicile) team1
, IF(T2.nom_fr, T1.nom_fr, CR.equipe_exterieur) team2
, 65 importance
, '' tournament_background
, SC.fuseau_horaire
, IF(ISNULL(LS.status) || M.status = 2 || M.status = 3 || M.status = 4, M.status, LS.status) match_status
, LS.serve
, S.time s_time_start
, S.court
, S.date_loc
, S.type s_type
, S.ordre s_order
, CT.nom court_name
, CT.ordre court_order
FROM
tournois_matchs M
INNER JOIN joueurs P1 on P1.id = M.j1
LEFT OUTER JOIN `joueurs` P1B on P1B.id = M.j1_bis
INNER JOIN joueurs P2 on P2.id = M.j2
LEFT OUTER JOIN `joueurs` P2B on P2B.id = M.j2_bis
LEFT JOIN tennis_rankings R1 on R1.player = P1.id AND R1.id = IF(P1.sexe = 1, 'wta', 'atp')
LEFT JOIN tennis_rankings R1B on R1B.player = P1B.id AND R1B.id = IF(P1B.sexe = 1, 'wta', 'atp')
LEFT JOIN tennis_rankings R2 on R2.player = P2.id AND R2.id = IF(P2.sexe = 1, 'wta', 'atp')
LEFT JOIN tennis_rankings R2B on R2B.player = P2B.id AND R2B.id = IF(P2B.sexe = 1, 'wta', 'atp')
LEFT OUTER JOIN `livescores_new`.`matchs` LS ON (LS.tt_match_id = M.id)
LEFT OUTER JOIN tournois_programmes S on S.idm = M.id
LEFT OUTER JOIN lieux_courts CT on (CT.ids = S.ids && CT.ordre = S.court)
INNER JOIN `coupes_rencontres` CR on CR.id = M.idt
INNER JOIN `coupes` C on C.id = CR.coupe_id
INNER JOIN tournois_name N on N.id = C.id
LEFT JOIN lieux_sites SL on SL.id = CR.lieu
LEFT JOIN lieux_villes SC on SC.id = SL.idv
LEFT JOIN lieux_pays SCO on SCO.code = SC.pays
LEFT JOIN `lieux_pays` T1 ON (T1.code = CR.equipe_domicile)
LEFT JOIN `lieux_pays` T2 ON (T2.code = CR.equipe_exterieur)
WHERE
M.id = '4063809'
&& M.type_tournoi_add = 1
&& (S.statut = 0 || S.statut = 4 || S.statut = 2 || ISNULL(S.statut))
UNION
SELECT
M.*
, M.time_start time_start
, M.time time_end
, M.duration_pause
, M.type_match_add type_match
, M.type_tournoi_add type_tournament
, '' level
, M.qualif
, M.idw winner_id
, P1.id p1_id
, P1.nom p1_name
, P1.prenom p1_first_name
, P1.name_zh p1_name_zh
, P1.birthday p1_birthday
, P1.sexe p1_gender
, P1.nat p1_nat
, P1.photo p1_photo
, P1.taille p1_height
, P1.poids p1_weight
, R1.rank p1_rank
, R1.liveRank p1_rank_live
, P1.pro_depuis p1_turn_pro
, '?' p1_best_rank
, P1.prise p1_forehand
, P1.revers p1_backhand
, M.ts1 p1_seed
, P1B.id p1b_id
, P1B.nom p1b_name
, P1B.prenom p1b_first_name
, P1B.name_zh p1b_name_zh
, P1B.birthday p1b_birthday
, P1B.sexe p1b_gender
, P1B.nat p1b_nat
, P1B.photo p1b_photo
, P1B.taille p1b_height
, P1B.poids p1b_weight
, R1B.rank p1b_rank
, R1B.liveRank p1b_rank_live
, P1B.pro_depuis p1b_turn_pro
, P2.id p2_id
, P2.nom p2_name
, P2.prenom p2_first_name
, P2.name_zh p2_name_zh
, P2.birthday p2_birthday
, P2.sexe p2_gender
, P2.nat p2_nat
, P2.photo p2_photo
, P2.taille p2_height
, P2.poids p2_weight
, R2.rank p2_rank
, R2.liveRank p2_rank_live
, P2.pro_depuis p2_turn_pro
, '?' p2_best_rank
, P2.prise p2_forehand
, P2.revers p2_backhand
, M.ts2 p2_seed
, P2B.id p2b_id
, P2B.nom p2b_name
, P2B.prenom p2b_first_name
, P2B.name_zh p2b_name_zh
, P2B.birthday p2b_birthday
, P2B.sexe p2b_gender
, P2B.nat p2b_nat
, P2B.photo p2b_photo
, P2B.taille p2b_height
, P2B.poids p2b_weight
, R2B.rank p2b_rank
, R2B.liveRank p2b_rank_live
, P2B.pro_depuis p2b_turn_pro
, L.id tournament_id
, 0 tournament_idt
, LR.id rencontre_id
, N.name_fr tournament_name_fr
, N.name_en tournament_name_en
, N.name_zh tournament_name_zh
, N.name_de tournament_name_de
, N.name_es tournament_name_es
, SC.nom tournament_city
, '' tournament_stadium
, '3' tournament_surface
, '' tournament_surface_photo
, '0' tournament_surface_color
, '' tournament_currency
, '' tournament_prize_money
, SCO.nom_fr tournament_country
, '' tournament_logo
, L.time_start tournament_start
, '' tournament_end
, '' tournament_nbPlayer
, '' tournament_genre
, '' tournament_category
, '' tournament_type
, LR.site tournament_site
, L.year tournament_year
, 0 tournament_importance
, '' team1
, '' team2
, 3 importance
, '' tournament_background
, SC.fuseau_horaire
, IF(ISNULL(LS.status) || M.status = 2 || M.status = 3 || M.status = 4, M.status, LS.status) match_status
, LS.serve
, S.time s_time_start
, S.court
, S.date_loc
, S.type s_type
, S.ordre s_order
, CT.nom court_name
, CT.ordre court_order
FROM
tournois_matchs M
JOIN joueurs P1 on P1.id = M.j1
LEFT JOIN `joueurs` P1B on P1B.id = M.j1_bis
JOIN joueurs P2 on P2.id = M.j2
LEFT JOIN `joueurs` P2B on P2B.id = M.j2_bis
LEFT JOIN tennis_rankings R1 on R1.player = P1.id AND R1.id = IF(P1.sexe = 1, 'wta', 'atp')
LEFT JOIN tennis_rankings R1B on R1B.player = P1B.id AND R1B.id = IF(P1B.sexe = 1, 'wta', 'atp')
LEFT JOIN tennis_rankings R2 on R2.player = P2.id AND R2.id = IF(P2.sexe = 1, 'wta', 'atp')
LEFT JOIN tennis_rankings R2B on R2B.player = P2B.id AND R2B.id = IF(P2B.sexe = 1, 'wta', 'atp')
LEFT JOIN `livescores_new`.`matchs` LS ON (LS.tt_match_id = M.id)
LEFT JOIN tournois_programmes S on S.idm = M.id
LEFT JOIN lieux_courts CT on (CT.ids = S.ids && CT.ordre = S.court)
JOIN `leagues_rounds` LR on LR.id = M.league_round
JOIN `leagues` L on L.id = LR.league
JOIN tournois_name N on N.league = L.id
LEFT JOIN lieux_sites SL on SL.id = LR.site
LEFT JOIN lieux_villes SC on SC.id = SL.idv
LEFT JOIN lieux_pays SCO on SCO.code = SC.pays
WHERE
M.id = '4063809'
&& M.type_tournoi_add = 2
&& (S.statut = 0 || S.statut = 4 || S.statut = 2 || ISNULL(S.statut))
LIMIT 1
SELECT M.*
, M.time_start time_start
, M.time time_end
, M.duration_pause
, M.type_match_add type_match
, M.type_tournoi_add type_tournament
, M.niveau level
, M.qualif
, M.idw winner_id
, P1.id p1_id
, P1.nom p1_name
, P1.prenom p1_first_name
, P1.name_zh p1_name_zh
, P1.birthday p1_birthday
, P1.sexe p1_gender
, P1.nat p1_nat
, P1.photo p1_photo
, P1.taille p1_height
, P1.poids p1_weight
, R1.rank p1_rank
, R1.liveRank p1_rank_live
, P1.pro_depuis p1_turn_pro
, '?' p1_best_rank
, P1.prise p1_forehand
, P1.revers p1_backhand
, M.ts1 p1_seed
, P1B.id p1b_id
, P1B.nom p1b_name
, P1B.prenom p1b_first_name
, P1B.name_zh p1b_name_zh
, P1B.birthday p1b_birthday
, P1B.sexe p1b_gender
, P1B.nat p1b_nat
, P1B.photo p1b_photo
, P1B.taille p1b_height
, P1B.poids p1b_weight
, R1B.rank p1b_rank
, R1B.liveRank p1b_rank_live
, P1B.pro_depuis p1b_turn_pro
, P2.id p2_id
, P2.nom p2_name
, P2.prenom p2_first_name
, P2.name_zh p2_name_zh
, P2.birthday p2_birthday
, P2.sexe p2_gender
, P2.nat p2_nat
, P2.photo p2_photo
, P2.taille p2_height
, P2.poids p2_weight
, R2.rank p2_rank
, R2.liveRank p2_rank_live
, P2.pro_depuis p2_turn_pro
, '?' p2_best_rank
, P2.prise p2_forehand
, P2.revers p2_backhand
, M.ts2 p2_seed
, P2B.id p2b_id
, P2B.nom p2b_name
, P2B.prenom p2b_first_name
, P2B.name_zh p2b_name_zh
, P2B.birthday p2b_birthday
, P2B.sexe p2b_gender
, P2B.nat p2b_nat
, P2B.photo p2b_photo
, P2B.taille p2b_height
, P2B.poids p2b_weight
, R2B.rank p2b_rank
, R2B.liveRank p2b_rank_live
, P2B.pro_depuis p2b_turn_pro
, T.id tournament_id
, T.idt tournament_idt
, '?' rencontre_id
, N.name_fr tournament_name_fr
, N.name_en tournament_name_en
, N.name_zh tournament_name_zh
, N.name_de tournament_name_de
, N.name_es tournament_name_es
, T.ville tournament_city
, T.stade tournament_stadium
, T.surface tournament_surface
, T.surface_photo tournament_surface_photo
, T.surface_color tournament_surface_color
, T.monnaie tournament_currency
, T.prix tournament_prize_money
, SCO.nom_fr tournament_country
, T.logo tournament_logo
, T.debut tournament_start
, T.fin tournament_end
, T.nbj tournament_nbPlayer
, T.genre tournament_genre
, T.category tournament_category
, T.type tournament_type
, T.ids tournament_site
, T.year tournament_year
, T.importance tournament_importance
, '' team1
, '' team2
, T.importance
, T.background tournament_background
, SC.fuseau_horaire
, IF(ISNULL(LS.status) || M.status = 2 || M.status = 3 || M.status = 4, M.status, LS.status) match_status
, LS.serve
, S.time s_time_start
, S.court
, S.date_loc
, S.type s_type
, S.ordre s_order
, C.nom court_name
, C.ordre court_order
FROM
tournois_matchs M
INNER JOIN joueurs P1 on P1.id = M.j1
LEFT OUTER JOIN `joueurs` P1B on P1B.id = M.j1_bis
INNER JOIN joueurs P2 on P2.id = M.j2
LEFT OUTER JOIN `joueurs` P2B on P2B.id = M.j2_bis
LEFT JOIN tennis_rankings R1 on R1.player = P1.id AND R1.id = IF(P1.sexe = 1, 'wta', 'atp')
LEFT JOIN tennis_rankings R1B on R1B.player = P1B.id AND R1B.id = IF(P1B.sexe = 1, 'wta', 'atp')
LEFT JOIN tennis_rankings R2 on R2.player = P2.id AND R2.id = IF(P2.sexe = 1, 'wta', 'atp')
LEFT JOIN tennis_rankings R2B on R2B.player = P2B.id AND R2B.id = IF(P2B.sexe = 1, 'wta', 'atp')
INNER JOIN tournois T on T.id = M.idt
INNER JOIN tournois_name N on N.id = T.id && N.cup = 0
LEFT OUTER JOIN lieux_sites SL on T.ids = SL.id
LEFT OUTER JOIN lieux_villes SC on SL.idv = SC.id
LEFT OUTER JOIN lieux_pays SCO on SCO.code = SC.pays
LEFT OUTER JOIN `livescores_new`.`matchs` LS on LS.tt_match_id = M.id
LEFT OUTER JOIN tournois_programmes S on S.idm = M.id
LEFT OUTER JOIN lieux_courts C on C.ids = S.ids && C.ordre = S.court
WHERE
M.id = '4063837'
&& M.type_tournoi_add = 0
&& (S.statut = 0 || S.statut = 4 || S.statut = 2 || ISNULL(S.statut))
UNION
SELECT
M.*
, M.time_start time_start
, M.time time_end
, M.duration_pause
, M.type_match_add type_match
, M.type_tournoi_add type_tournament
, CR.niveau level
, M.qualif
, M.idw winner_id
, P1.id p1_id
, P1.nom p1_name
, P1.prenom p1_first_name
, P1.name_zh p1_name_zh
, P1.birthday p1_birthday
, P1.sexe p1_gender
, P1.nat p1_nat
, P1.photo p1_photo
, P1.taille p1_height
, P1.poids p1_weight
, R1.rank p1_rank
, R1.liveRank p1_rank_live
, P1.pro_depuis p1_turn_pro
, '?' p1_best_rank
, P1.prise p1_forehand
, P1.revers p1_backhand
, M.ts1 p1_seed
, P1B.id p1b_id
, P1B.nom p1b_name
, P1B.prenom p1b_first_name
, P1B.name_zh p1b_name_zh
, P1B.birthday p1b_birthday
, P1B.sexe p1b_gender
, P1B.nat p1b_nat
, P1B.photo p1b_photo
, P1B.taille p1b_height
, P1B.poids p1b_weight
, R1B.rank p1b_rank
, R1B.liveRank p1b_rank_live
, P1B.pro_depuis p1b_turn_pro
, P2.id p2_id
, P2.nom p2_name
, P2.prenom p2_first_name
, P2.name_zh p2_name_zh
, P2.birthday p2_birthday
, P2.sexe p2_gender
, P2.nat p2_nat
, P2.photo p2_photo
, P2.taille p2_height
, P2.poids p2_weight
, R2.rank p2_rank
, R2.liveRank p2_rank_live
, P2.pro_depuis p2_turn_pro
, '?' p2_best_rank
, P2.prise p2_forehand
, P2.revers p2_backhand
, M.ts2 p2_seed
, P2B.id p2b_id
, P2B.nom p2b_name
, P2B.prenom p2b_first_name
, P2B.name_zh p2b_name_zh
, P2B.birthday p2b_birthday
, P2B.sexe p2b_gender
, P2B.nat p2b_nat
, P2B.photo p2b_photo
, P2B.taille p2b_height
, P2B.poids p2b_weight
, R2B.rank p2b_rank
, R2B.liveRank p2b_rank_live
, P2B.pro_depuis p2b_turn_pro
, C.id tournament_id
, C.parent tournament_idt
, CR.id rencontre_id
, N.name_fr tournament_name_fr
, N.name_en tournament_name_en
, N.name_zh tournament_name_zh
, N.name_de tournament_name_de
, N.name_es tournament_name_es
, CONCAT(CR.equipe_domicile, '|', CR.equipe_exterieur) tournament_city
, '' tournament_stadium
, CR.surface tournament_surface
, '' tournament_surface_photo
, '0' tournament_surface_color
, '' tournament_currency
, '' tournament_prize_money
, SCO.nom_fr tournament_country
, '' tournament_logo
, CR.date_d tournament_start
, '' tournament_end
, C.nbj tournament_nbPlayer
, '' tournament_genre
, '' tournament_category
, '' tournament_type
, CR.lieu tournament_site
, '' tournament_year
, 65 tournament_importance
, IF(T1.nom_fr, T1.nom_fr, CR.equipe_domicile) team1
, IF(T2.nom_fr, T1.nom_fr, CR.equipe_exterieur) team2
, 65 importance
, '' tournament_background
, SC.fuseau_horaire
, IF(ISNULL(LS.status) || M.status = 2 || M.status = 3 || M.status = 4, M.status, LS.status) match_status
, LS.serve
, S.time s_time_start
, S.court
, S.date_loc
, S.type s_type
, S.ordre s_order
, CT.nom court_name
, CT.ordre court_order
FROM
tournois_matchs M
INNER JOIN joueurs P1 on P1.id = M.j1
LEFT OUTER JOIN `joueurs` P1B on P1B.id = M.j1_bis
INNER JOIN joueurs P2 on P2.id = M.j2
LEFT OUTER JOIN `joueurs` P2B on P2B.id = M.j2_bis
LEFT JOIN tennis_rankings R1 on R1.player = P1.id AND R1.id = IF(P1.sexe = 1, 'wta', 'atp')
LEFT JOIN tennis_rankings R1B on R1B.player = P1B.id AND R1B.id = IF(P1B.sexe = 1, 'wta', 'atp')
LEFT JOIN tennis_rankings R2 on R2.player = P2.id AND R2.id = IF(P2.sexe = 1, 'wta', 'atp')
LEFT JOIN tennis_rankings R2B on R2B.player = P2B.id AND R2B.id = IF(P2B.sexe = 1, 'wta', 'atp')
LEFT OUTER JOIN `livescores_new`.`matchs` LS ON (LS.tt_match_id = M.id)
LEFT OUTER JOIN tournois_programmes S on S.idm = M.id
LEFT OUTER JOIN lieux_courts CT on (CT.ids = S.ids && CT.ordre = S.court)
INNER JOIN `coupes_rencontres` CR on CR.id = M.idt
INNER JOIN `coupes` C on C.id = CR.coupe_id
INNER JOIN tournois_name N on N.id = C.id
LEFT JOIN lieux_sites SL on SL.id = CR.lieu
LEFT JOIN lieux_villes SC on SC.id = SL.idv
LEFT JOIN lieux_pays SCO on SCO.code = SC.pays
LEFT JOIN `lieux_pays` T1 ON (T1.code = CR.equipe_domicile)
LEFT JOIN `lieux_pays` T2 ON (T2.code = CR.equipe_exterieur)
WHERE
M.id = '4063837'
&& M.type_tournoi_add = 1
&& (S.statut = 0 || S.statut = 4 || S.statut = 2 || ISNULL(S.statut))
UNION
SELECT
M.*
, M.time_start time_start
, M.time time_end
, M.duration_pause
, M.type_match_add type_match
, M.type_tournoi_add type_tournament
, '' level
, M.qualif
, M.idw winner_id
, P1.id p1_id
, P1.nom p1_name
, P1.prenom p1_first_name
, P1.name_zh p1_name_zh
, P1.birthday p1_birthday
, P1.sexe p1_gender
, P1.nat p1_nat
, P1.photo p1_photo
, P1.taille p1_height
, P1.poids p1_weight
, R1.rank p1_rank
, R1.liveRank p1_rank_live
, P1.pro_depuis p1_turn_pro
, '?' p1_best_rank
, P1.prise p1_forehand
, P1.revers p1_backhand
, M.ts1 p1_seed
, P1B.id p1b_id
, P1B.nom p1b_name
, P1B.prenom p1b_first_name
, P1B.name_zh p1b_name_zh
, P1B.birthday p1b_birthday
, P1B.sexe p1b_gender
, P1B.nat p1b_nat
, P1B.photo p1b_photo
, P1B.taille p1b_height
, P1B.poids p1b_weight
, R1B.rank p1b_rank
, R1B.liveRank p1b_rank_live
, P1B.pro_depuis p1b_turn_pro
, P2.id p2_id
, P2.nom p2_name
, P2.prenom p2_first_name
, P2.name_zh p2_name_zh
, P2.birthday p2_birthday
, P2.sexe p2_gender
, P2.nat p2_nat
, P2.photo p2_photo
, P2.taille p2_height
, P2.poids p2_weight
, R2.rank p2_rank
, R2.liveRank p2_rank_live
, P2.pro_depuis p2_turn_pro
, '?' p2_best_rank
, P2.prise p2_forehand
, P2.revers p2_backhand
, M.ts2 p2_seed
, P2B.id p2b_id
, P2B.nom p2b_name
, P2B.prenom p2b_first_name
, P2B.name_zh p2b_name_zh
, P2B.birthday p2b_birthday
, P2B.sexe p2b_gender
, P2B.nat p2b_nat
, P2B.photo p2b_photo
, P2B.taille p2b_height
, P2B.poids p2b_weight
, R2B.rank p2b_rank
, R2B.liveRank p2b_rank_live
, P2B.pro_depuis p2b_turn_pro
, L.id tournament_id
, 0 tournament_idt
, LR.id rencontre_id
, N.name_fr tournament_name_fr
, N.name_en tournament_name_en
, N.name_zh tournament_name_zh
, N.name_de tournament_name_de
, N.name_es tournament_name_es
, SC.nom tournament_city
, '' tournament_stadium
, '3' tournament_surface
, '' tournament_surface_photo
, '0' tournament_surface_color
, '' tournament_currency
, '' tournament_prize_money
, SCO.nom_fr tournament_country
, '' tournament_logo
, L.time_start tournament_start
, '' tournament_end
, '' tournament_nbPlayer
, '' tournament_genre
, '' tournament_category
, '' tournament_type
, LR.site tournament_site
, L.year tournament_year
, 0 tournament_importance
, '' team1
, '' team2
, 3 importance
, '' tournament_background
, SC.fuseau_horaire
, IF(ISNULL(LS.status) || M.status = 2 || M.status = 3 || M.status = 4, M.status, LS.status) match_status
, LS.serve
, S.time s_time_start
, S.court
, S.date_loc
, S.type s_type
, S.ordre s_order
, CT.nom court_name
, CT.ordre court_order
FROM
tournois_matchs M
JOIN joueurs P1 on P1.id = M.j1
LEFT JOIN `joueurs` P1B on P1B.id = M.j1_bis
JOIN joueurs P2 on P2.id = M.j2
LEFT JOIN `joueurs` P2B on P2B.id = M.j2_bis
LEFT JOIN tennis_rankings R1 on R1.player = P1.id AND R1.id = IF(P1.sexe = 1, 'wta', 'atp')
LEFT JOIN tennis_rankings R1B on R1B.player = P1B.id AND R1B.id = IF(P1B.sexe = 1, 'wta', 'atp')
LEFT JOIN tennis_rankings R2 on R2.player = P2.id AND R2.id = IF(P2.sexe = 1, 'wta', 'atp')
LEFT JOIN tennis_rankings R2B on R2B.player = P2B.id AND R2B.id = IF(P2B.sexe = 1, 'wta', 'atp')
LEFT JOIN `livescores_new`.`matchs` LS ON (LS.tt_match_id = M.id)
LEFT JOIN tournois_programmes S on S.idm = M.id
LEFT JOIN lieux_courts CT on (CT.ids = S.ids && CT.ordre = S.court)
JOIN `leagues_rounds` LR on LR.id = M.league_round
JOIN `leagues` L on L.id = LR.league
JOIN tournois_name N on N.league = L.id
LEFT JOIN lieux_sites SL on SL.id = LR.site
LEFT JOIN lieux_villes SC on SC.id = SL.idv
LEFT JOIN lieux_pays SCO on SCO.code = SC.pays
WHERE
M.id = '4063837'
&& M.type_tournoi_add = 2
&& (S.statut = 0 || S.statut = 4 || S.statut = 2 || ISNULL(S.statut))
LIMIT 1
SELECT M.*
, M.time_start time_start
, M.time time_end
, M.duration_pause
, M.type_match_add type_match
, M.type_tournoi_add type_tournament
, M.niveau level
, M.qualif
, M.idw winner_id
, P1.id p1_id
, P1.nom p1_name
, P1.prenom p1_first_name
, P1.name_zh p1_name_zh
, P1.birthday p1_birthday
, P1.sexe p1_gender
, P1.nat p1_nat
, P1.photo p1_photo
, P1.taille p1_height
, P1.poids p1_weight
, R1.rank p1_rank
, R1.liveRank p1_rank_live
, P1.pro_depuis p1_turn_pro
, '?' p1_best_rank
, P1.prise p1_forehand
, P1.revers p1_backhand
, M.ts1 p1_seed
, P1B.id p1b_id
, P1B.nom p1b_name
, P1B.prenom p1b_first_name
, P1B.name_zh p1b_name_zh
, P1B.birthday p1b_birthday
, P1B.sexe p1b_gender
, P1B.nat p1b_nat
, P1B.photo p1b_photo
, P1B.taille p1b_height
, P1B.poids p1b_weight
, R1B.rank p1b_rank
, R1B.liveRank p1b_rank_live
, P1B.pro_depuis p1b_turn_pro
, P2.id p2_id
, P2.nom p2_name
, P2.prenom p2_first_name
, P2.name_zh p2_name_zh
, P2.birthday p2_birthday
, P2.sexe p2_gender
, P2.nat p2_nat
, P2.photo p2_photo
, P2.taille p2_height
, P2.poids p2_weight
, R2.rank p2_rank
, R2.liveRank p2_rank_live
, P2.pro_depuis p2_turn_pro
, '?' p2_best_rank
, P2.prise p2_forehand
, P2.revers p2_backhand
, M.ts2 p2_seed
, P2B.id p2b_id
, P2B.nom p2b_name
, P2B.prenom p2b_first_name
, P2B.name_zh p2b_name_zh
, P2B.birthday p2b_birthday
, P2B.sexe p2b_gender
, P2B.nat p2b_nat
, P2B.photo p2b_photo
, P2B.taille p2b_height
, P2B.poids p2b_weight
, R2B.rank p2b_rank
, R2B.liveRank p2b_rank_live
, P2B.pro_depuis p2b_turn_pro
, T.id tournament_id
, T.idt tournament_idt
, '?' rencontre_id
, N.name_fr tournament_name_fr
, N.name_en tournament_name_en
, N.name_zh tournament_name_zh
, N.name_de tournament_name_de
, N.name_es tournament_name_es
, T.ville tournament_city
, T.stade tournament_stadium
, T.surface tournament_surface
, T.surface_photo tournament_surface_photo
, T.surface_color tournament_surface_color
, T.monnaie tournament_currency
, T.prix tournament_prize_money
, SCO.nom_fr tournament_country
, T.logo tournament_logo
, T.debut tournament_start
, T.fin tournament_end
, T.nbj tournament_nbPlayer
, T.genre tournament_genre
, T.category tournament_category
, T.type tournament_type
, T.ids tournament_site
, T.year tournament_year
, T.importance tournament_importance
, '' team1
, '' team2
, T.importance
, T.background tournament_background
, SC.fuseau_horaire
, IF(ISNULL(LS.status) || M.status = 2 || M.status = 3 || M.status = 4, M.status, LS.status) match_status
, LS.serve
, S.time s_time_start
, S.court
, S.date_loc
, S.type s_type
, S.ordre s_order
, C.nom court_name
, C.ordre court_order
FROM
tournois_matchs M
INNER JOIN joueurs P1 on P1.id = M.j1
LEFT OUTER JOIN `joueurs` P1B on P1B.id = M.j1_bis
INNER JOIN joueurs P2 on P2.id = M.j2
LEFT OUTER JOIN `joueurs` P2B on P2B.id = M.j2_bis
LEFT JOIN tennis_rankings R1 on R1.player = P1.id AND R1.id = IF(P1.sexe = 1, 'wta', 'atp')
LEFT JOIN tennis_rankings R1B on R1B.player = P1B.id AND R1B.id = IF(P1B.sexe = 1, 'wta', 'atp')
LEFT JOIN tennis_rankings R2 on R2.player = P2.id AND R2.id = IF(P2.sexe = 1, 'wta', 'atp')
LEFT JOIN tennis_rankings R2B on R2B.player = P2B.id AND R2B.id = IF(P2B.sexe = 1, 'wta', 'atp')
INNER JOIN tournois T on T.id = M.idt
INNER JOIN tournois_name N on N.id = T.id && N.cup = 0
LEFT OUTER JOIN lieux_sites SL on T.ids = SL.id
LEFT OUTER JOIN lieux_villes SC on SL.idv = SC.id
LEFT OUTER JOIN lieux_pays SCO on SCO.code = SC.pays
LEFT OUTER JOIN `livescores_new`.`matchs` LS on LS.tt_match_id = M.id
LEFT OUTER JOIN tournois_programmes S on S.idm = M.id
LEFT OUTER JOIN lieux_courts C on C.ids = S.ids && C.ordre = S.court
WHERE
M.id = '4063819'
&& M.type_tournoi_add = 0
&& (S.statut = 0 || S.statut = 4 || S.statut = 2 || ISNULL(S.statut))
UNION
SELECT
M.*
, M.time_start time_start
, M.time time_end
, M.duration_pause
, M.type_match_add type_match
, M.type_tournoi_add type_tournament
, CR.niveau level
, M.qualif
, M.idw winner_id
, P1.id p1_id
, P1.nom p1_name
, P1.prenom p1_first_name
, P1.name_zh p1_name_zh
, P1.birthday p1_birthday
, P1.sexe p1_gender
, P1.nat p1_nat
, P1.photo p1_photo
, P1.taille p1_height
, P1.poids p1_weight
, R1.rank p1_rank
, R1.liveRank p1_rank_live
, P1.pro_depuis p1_turn_pro
, '?' p1_best_rank
, P1.prise p1_forehand
, P1.revers p1_backhand
, M.ts1 p1_seed
, P1B.id p1b_id
, P1B.nom p1b_name
, P1B.prenom p1b_first_name
, P1B.name_zh p1b_name_zh
, P1B.birthday p1b_birthday
, P1B.sexe p1b_gender
, P1B.nat p1b_nat
, P1B.photo p1b_photo
, P1B.taille p1b_height
, P1B.poids p1b_weight
, R1B.rank p1b_rank
, R1B.liveRank p1b_rank_live
, P1B.pro_depuis p1b_turn_pro
, P2.id p2_id
, P2.nom p2_name
, P2.prenom p2_first_name
, P2.name_zh p2_name_zh
, P2.birthday p2_birthday
, P2.sexe p2_gender
, P2.nat p2_nat
, P2.photo p2_photo
, P2.taille p2_height
, P2.poids p2_weight
, R2.rank p2_rank
, R2.liveRank p2_rank_live
, P2.pro_depuis p2_turn_pro
, '?' p2_best_rank
, P2.prise p2_forehand
, P2.revers p2_backhand
, M.ts2 p2_seed
, P2B.id p2b_id
, P2B.nom p2b_name
, P2B.prenom p2b_first_name
, P2B.name_zh p2b_name_zh
, P2B.birthday p2b_birthday
, P2B.sexe p2b_gender
, P2B.nat p2b_nat
, P2B.photo p2b_photo
, P2B.taille p2b_height
, P2B.poids p2b_weight
, R2B.rank p2b_rank
, R2B.liveRank p2b_rank_live
, P2B.pro_depuis p2b_turn_pro
, C.id tournament_id
, C.parent tournament_idt
, CR.id rencontre_id
, N.name_fr tournament_name_fr
, N.name_en tournament_name_en
, N.name_zh tournament_name_zh
, N.name_de tournament_name_de
, N.name_es tournament_name_es
, CONCAT(CR.equipe_domicile, '|', CR.equipe_exterieur) tournament_city
, '' tournament_stadium
, CR.surface tournament_surface
, '' tournament_surface_photo
, '0' tournament_surface_color
, '' tournament_currency
, '' tournament_prize_money
, SCO.nom_fr tournament_country
, '' tournament_logo
, CR.date_d tournament_start
, '' tournament_end
, C.nbj tournament_nbPlayer
, '' tournament_genre
, '' tournament_category
, '' tournament_type
, CR.lieu tournament_site
, '' tournament_year
, 65 tournament_importance
, IF(T1.nom_fr, T1.nom_fr, CR.equipe_domicile) team1
, IF(T2.nom_fr, T1.nom_fr, CR.equipe_exterieur) team2
, 65 importance
, '' tournament_background
, SC.fuseau_horaire
, IF(ISNULL(LS.status) || M.status = 2 || M.status = 3 || M.status = 4, M.status, LS.status) match_status
, LS.serve
, S.time s_time_start
, S.court
, S.date_loc
, S.type s_type
, S.ordre s_order
, CT.nom court_name
, CT.ordre court_order
FROM
tournois_matchs M
INNER JOIN joueurs P1 on P1.id = M.j1
LEFT OUTER JOIN `joueurs` P1B on P1B.id = M.j1_bis
INNER JOIN joueurs P2 on P2.id = M.j2
LEFT OUTER JOIN `joueurs` P2B on P2B.id = M.j2_bis
LEFT JOIN tennis_rankings R1 on R1.player = P1.id AND R1.id = IF(P1.sexe = 1, 'wta', 'atp')
LEFT JOIN tennis_rankings R1B on R1B.player = P1B.id AND R1B.id = IF(P1B.sexe = 1, 'wta', 'atp')
LEFT JOIN tennis_rankings R2 on R2.player = P2.id AND R2.id = IF(P2.sexe = 1, 'wta', 'atp')
LEFT JOIN tennis_rankings R2B on R2B.player = P2B.id AND R2B.id = IF(P2B.sexe = 1, 'wta', 'atp')
LEFT OUTER JOIN `livescores_new`.`matchs` LS ON (LS.tt_match_id = M.id)
LEFT OUTER JOIN tournois_programmes S on S.idm = M.id
LEFT OUTER JOIN lieux_courts CT on (CT.ids = S.ids && CT.ordre = S.court)
INNER JOIN `coupes_rencontres` CR on CR.id = M.idt
INNER JOIN `coupes` C on C.id = CR.coupe_id
INNER JOIN tournois_name N on N.id = C.id
LEFT JOIN lieux_sites SL on SL.id = CR.lieu
LEFT JOIN lieux_villes SC on SC.id = SL.idv
LEFT JOIN lieux_pays SCO on SCO.code = SC.pays
LEFT JOIN `lieux_pays` T1 ON (T1.code = CR.equipe_domicile)
LEFT JOIN `lieux_pays` T2 ON (T2.code = CR.equipe_exterieur)
WHERE
M.id = '4063819'
&& M.type_tournoi_add = 1
&& (S.statut = 0 || S.statut = 4 || S.statut = 2 || ISNULL(S.statut))
UNION
SELECT
M.*
, M.time_start time_start
, M.time time_end
, M.duration_pause
, M.type_match_add type_match
, M.type_tournoi_add type_tournament
, '' level
, M.qualif
, M.idw winner_id
, P1.id p1_id
, P1.nom p1_name
, P1.prenom p1_first_name
, P1.name_zh p1_name_zh
, P1.birthday p1_birthday
, P1.sexe p1_gender
, P1.nat p1_nat
, P1.photo p1_photo
, P1.taille p1_height
, P1.poids p1_weight
, R1.rank p1_rank
, R1.liveRank p1_rank_live
, P1.pro_depuis p1_turn_pro
, '?' p1_best_rank
, P1.prise p1_forehand
, P1.revers p1_backhand
, M.ts1 p1_seed
, P1B.id p1b_id
, P1B.nom p1b_name
, P1B.prenom p1b_first_name
, P1B.name_zh p1b_name_zh
, P1B.birthday p1b_birthday
, P1B.sexe p1b_gender
, P1B.nat p1b_nat
, P1B.photo p1b_photo
, P1B.taille p1b_height
, P1B.poids p1b_weight
, R1B.rank p1b_rank
, R1B.liveRank p1b_rank_live
, P1B.pro_depuis p1b_turn_pro
, P2.id p2_id
, P2.nom p2_name
, P2.prenom p2_first_name
, P2.name_zh p2_name_zh
, P2.birthday p2_birthday
, P2.sexe p2_gender
, P2.nat p2_nat
, P2.photo p2_photo
, P2.taille p2_height
, P2.poids p2_weight
, R2.rank p2_rank
, R2.liveRank p2_rank_live
, P2.pro_depuis p2_turn_pro
, '?' p2_best_rank
, P2.prise p2_forehand
, P2.revers p2_backhand
, M.ts2 p2_seed
, P2B.id p2b_id
, P2B.nom p2b_name
, P2B.prenom p2b_first_name
, P2B.name_zh p2b_name_zh
, P2B.birthday p2b_birthday
, P2B.sexe p2b_gender
, P2B.nat p2b_nat
, P2B.photo p2b_photo
, P2B.taille p2b_height
, P2B.poids p2b_weight
, R2B.rank p2b_rank
, R2B.liveRank p2b_rank_live
, P2B.pro_depuis p2b_turn_pro
, L.id tournament_id
, 0 tournament_idt
, LR.id rencontre_id
, N.name_fr tournament_name_fr
, N.name_en tournament_name_en
, N.name_zh tournament_name_zh
, N.name_de tournament_name_de
, N.name_es tournament_name_es
, SC.nom tournament_city
, '' tournament_stadium
, '3' tournament_surface
, '' tournament_surface_photo
, '0' tournament_surface_color
, '' tournament_currency
, '' tournament_prize_money
, SCO.nom_fr tournament_country
, '' tournament_logo
, L.time_start tournament_start
, '' tournament_end
, '' tournament_nbPlayer
, '' tournament_genre
, '' tournament_category
, '' tournament_type
, LR.site tournament_site
, L.year tournament_year
, 0 tournament_importance
, '' team1
, '' team2
, 3 importance
, '' tournament_background
, SC.fuseau_horaire
, IF(ISNULL(LS.status) || M.status = 2 || M.status = 3 || M.status = 4, M.status, LS.status) match_status
, LS.serve
, S.time s_time_start
, S.court
, S.date_loc
, S.type s_type
, S.ordre s_order
, CT.nom court_name
, CT.ordre court_order
FROM
tournois_matchs M
JOIN joueurs P1 on P1.id = M.j1
LEFT JOIN `joueurs` P1B on P1B.id = M.j1_bis
JOIN joueurs P2 on P2.id = M.j2
LEFT JOIN `joueurs` P2B on P2B.id = M.j2_bis
LEFT JOIN tennis_rankings R1 on R1.player = P1.id AND R1.id = IF(P1.sexe = 1, 'wta', 'atp')
LEFT JOIN tennis_rankings R1B on R1B.player = P1B.id AND R1B.id = IF(P1B.sexe = 1, 'wta', 'atp')
LEFT JOIN tennis_rankings R2 on R2.player = P2.id AND R2.id = IF(P2.sexe = 1, 'wta', 'atp')
LEFT JOIN tennis_rankings R2B on R2B.player = P2B.id AND R2B.id = IF(P2B.sexe = 1, 'wta', 'atp')
LEFT JOIN `livescores_new`.`matchs` LS ON (LS.tt_match_id = M.id)
LEFT JOIN tournois_programmes S on S.idm = M.id
LEFT JOIN lieux_courts CT on (CT.ids = S.ids && CT.ordre = S.court)
JOIN `leagues_rounds` LR on LR.id = M.league_round
JOIN `leagues` L on L.id = LR.league
JOIN tournois_name N on N.league = L.id
LEFT JOIN lieux_sites SL on SL.id = LR.site
LEFT JOIN lieux_villes SC on SC.id = SL.idv
LEFT JOIN lieux_pays SCO on SCO.code = SC.pays
WHERE
M.id = '4063819'
&& M.type_tournoi_add = 2
&& (S.statut = 0 || S.statut = 4 || S.statut = 2 || ISNULL(S.statut))
LIMIT 1
SELECT M.*
, M.time_start time_start
, M.time time_end
, M.duration_pause
, M.type_match_add type_match
, M.type_tournoi_add type_tournament
, M.niveau level
, M.qualif
, M.idw winner_id
, P1.id p1_id
, P1.nom p1_name
, P1.prenom p1_first_name
, P1.name_zh p1_name_zh
, P1.birthday p1_birthday
, P1.sexe p1_gender
, P1.nat p1_nat
, P1.photo p1_photo
, P1.taille p1_height
, P1.poids p1_weight
, R1.rank p1_rank
, R1.liveRank p1_rank_live
, P1.pro_depuis p1_turn_pro
, '?' p1_best_rank
, P1.prise p1_forehand
, P1.revers p1_backhand
, M.ts1 p1_seed
, P1B.id p1b_id
, P1B.nom p1b_name
, P1B.prenom p1b_first_name
, P1B.name_zh p1b_name_zh
, P1B.birthday p1b_birthday
, P1B.sexe p1b_gender
, P1B.nat p1b_nat
, P1B.photo p1b_photo
, P1B.taille p1b_height
, P1B.poids p1b_weight
, R1B.rank p1b_rank
, R1B.liveRank p1b_rank_live
, P1B.pro_depuis p1b_turn_pro
, P2.id p2_id
, P2.nom p2_name
, P2.prenom p2_first_name
, P2.name_zh p2_name_zh
, P2.birthday p2_birthday
, P2.sexe p2_gender
, P2.nat p2_nat
, P2.photo p2_photo
, P2.taille p2_height
, P2.poids p2_weight
, R2.rank p2_rank
, R2.liveRank p2_rank_live
, P2.pro_depuis p2_turn_pro
, '?' p2_best_rank
, P2.prise p2_forehand
, P2.revers p2_backhand
, M.ts2 p2_seed
, P2B.id p2b_id
, P2B.nom p2b_name
, P2B.prenom p2b_first_name
, P2B.name_zh p2b_name_zh
, P2B.birthday p2b_birthday
, P2B.sexe p2b_gender
, P2B.nat p2b_nat
, P2B.photo p2b_photo
, P2B.taille p2b_height
, P2B.poids p2b_weight
, R2B.rank p2b_rank
, R2B.liveRank p2b_rank_live
, P2B.pro_depuis p2b_turn_pro
, T.id tournament_id
, T.idt tournament_idt
, '?' rencontre_id
, N.name_fr tournament_name_fr
, N.name_en tournament_name_en
, N.name_zh tournament_name_zh
, N.name_de tournament_name_de
, N.name_es tournament_name_es
, T.ville tournament_city
, T.stade tournament_stadium
, T.surface tournament_surface
, T.surface_photo tournament_surface_photo
, T.surface_color tournament_surface_color
, T.monnaie tournament_currency
, T.prix tournament_prize_money
, SCO.nom_fr tournament_country
, T.logo tournament_logo
, T.debut tournament_start
, T.fin tournament_end
, T.nbj tournament_nbPlayer
, T.genre tournament_genre
, T.category tournament_category
, T.type tournament_type
, T.ids tournament_site
, T.year tournament_year
, T.importance tournament_importance
, '' team1
, '' team2
, T.importance
, T.background tournament_background
, SC.fuseau_horaire
, IF(ISNULL(LS.status) || M.status = 2 || M.status = 3 || M.status = 4, M.status, LS.status) match_status
, LS.serve
, S.time s_time_start
, S.court
, S.date_loc
, S.type s_type
, S.ordre s_order
, C.nom court_name
, C.ordre court_order
FROM
tournois_matchs M
INNER JOIN joueurs P1 on P1.id = M.j1
LEFT OUTER JOIN `joueurs` P1B on P1B.id = M.j1_bis
INNER JOIN joueurs P2 on P2.id = M.j2
LEFT OUTER JOIN `joueurs` P2B on P2B.id = M.j2_bis
LEFT JOIN tennis_rankings R1 on R1.player = P1.id AND R1.id = IF(P1.sexe = 1, 'wta', 'atp')
LEFT JOIN tennis_rankings R1B on R1B.player = P1B.id AND R1B.id = IF(P1B.sexe = 1, 'wta', 'atp')
LEFT JOIN tennis_rankings R2 on R2.player = P2.id AND R2.id = IF(P2.sexe = 1, 'wta', 'atp')
LEFT JOIN tennis_rankings R2B on R2B.player = P2B.id AND R2B.id = IF(P2B.sexe = 1, 'wta', 'atp')
INNER JOIN tournois T on T.id = M.idt
INNER JOIN tournois_name N on N.id = T.id && N.cup = 0
LEFT OUTER JOIN lieux_sites SL on T.ids = SL.id
LEFT OUTER JOIN lieux_villes SC on SL.idv = SC.id
LEFT OUTER JOIN lieux_pays SCO on SCO.code = SC.pays
LEFT OUTER JOIN `livescores_new`.`matchs` LS on LS.tt_match_id = M.id
LEFT OUTER JOIN tournois_programmes S on S.idm = M.id
LEFT OUTER JOIN lieux_courts C on C.ids = S.ids && C.ordre = S.court
WHERE
M.id = '4063829'
&& M.type_tournoi_add = 0
&& (S.statut = 0 || S.statut = 4 || S.statut = 2 || ISNULL(S.statut))
UNION
SELECT
M.*
, M.time_start time_start
, M.time time_end
, M.duration_pause
, M.type_match_add type_match
, M.type_tournoi_add type_tournament
, CR.niveau level
, M.qualif
, M.idw winner_id
, P1.id p1_id
, P1.nom p1_name
, P1.prenom p1_first_name
, P1.name_zh p1_name_zh
, P1.birthday p1_birthday
, P1.sexe p1_gender
, P1.nat p1_nat
, P1.photo p1_photo
, P1.taille p1_height
, P1.poids p1_weight
, R1.rank p1_rank
, R1.liveRank p1_rank_live
, P1.pro_depuis p1_turn_pro
, '?' p1_best_rank
, P1.prise p1_forehand
, P1.revers p1_backhand
, M.ts1 p1_seed
, P1B.id p1b_id
, P1B.nom p1b_name
, P1B.prenom p1b_first_name
, P1B.name_zh p1b_name_zh
, P1B.birthday p1b_birthday
, P1B.sexe p1b_gender
, P1B.nat p1b_nat
, P1B.photo p1b_photo
, P1B.taille p1b_height
, P1B.poids p1b_weight
, R1B.rank p1b_rank
, R1B.liveRank p1b_rank_live
, P1B.pro_depuis p1b_turn_pro
, P2.id p2_id
, P2.nom p2_name
, P2.prenom p2_first_name
, P2.name_zh p2_name_zh
, P2.birthday p2_birthday
, P2.sexe p2_gender
, P2.nat p2_nat
, P2.photo p2_photo
, P2.taille p2_height
, P2.poids p2_weight
, R2.rank p2_rank
, R2.liveRank p2_rank_live
, P2.pro_depuis p2_turn_pro
, '?' p2_best_rank
, P2.prise p2_forehand
, P2.revers p2_backhand
, M.ts2 p2_seed
, P2B.id p2b_id
, P2B.nom p2b_name
, P2B.prenom p2b_first_name
, P2B.name_zh p2b_name_zh
, P2B.birthday p2b_birthday
, P2B.sexe p2b_gender
, P2B.nat p2b_nat
, P2B.photo p2b_photo
, P2B.taille p2b_height
, P2B.poids p2b_weight
, R2B.rank p2b_rank
, R2B.liveRank p2b_rank_live
, P2B.pro_depuis p2b_turn_pro
, C.id tournament_id
, C.parent tournament_idt
, CR.id rencontre_id
, N.name_fr tournament_name_fr
, N.name_en tournament_name_en
, N.name_zh tournament_name_zh
, N.name_de tournament_name_de
, N.name_es tournament_name_es
, CONCAT(CR.equipe_domicile, '|', CR.equipe_exterieur) tournament_city
, '' tournament_stadium
, CR.surface tournament_surface
, '' tournament_surface_photo
, '0' tournament_surface_color
, '' tournament_currency
, '' tournament_prize_money
, SCO.nom_fr tournament_country
, '' tournament_logo
, CR.date_d tournament_start
, '' tournament_end
, C.nbj tournament_nbPlayer
, '' tournament_genre
, '' tournament_category
, '' tournament_type
, CR.lieu tournament_site
, '' tournament_year
, 65 tournament_importance
, IF(T1.nom_fr, T1.nom_fr, CR.equipe_domicile) team1
, IF(T2.nom_fr, T1.nom_fr, CR.equipe_exterieur) team2
, 65 importance
, '' tournament_background
, SC.fuseau_horaire
, IF(ISNULL(LS.status) || M.status = 2 || M.status = 3 || M.status = 4, M.status, LS.status) match_status
, LS.serve
, S.time s_time_start
, S.court
, S.date_loc
, S.type s_type
, S.ordre s_order
, CT.nom court_name
, CT.ordre court_order
FROM
tournois_matchs M
INNER JOIN joueurs P1 on P1.id = M.j1
LEFT OUTER JOIN `joueurs` P1B on P1B.id = M.j1_bis
INNER JOIN joueurs P2 on P2.id = M.j2
LEFT OUTER JOIN `joueurs` P2B on P2B.id = M.j2_bis
LEFT JOIN tennis_rankings R1 on R1.player = P1.id AND R1.id = IF(P1.sexe = 1, 'wta', 'atp')
LEFT JOIN tennis_rankings R1B on R1B.player = P1B.id AND R1B.id = IF(P1B.sexe = 1, 'wta', 'atp')
LEFT JOIN tennis_rankings R2 on R2.player = P2.id AND R2.id = IF(P2.sexe = 1, 'wta', 'atp')
LEFT JOIN tennis_rankings R2B on R2B.player = P2B.id AND R2B.id = IF(P2B.sexe = 1, 'wta', 'atp')
LEFT OUTER JOIN `livescores_new`.`matchs` LS ON (LS.tt_match_id = M.id)
LEFT OUTER JOIN tournois_programmes S on S.idm = M.id
LEFT OUTER JOIN lieux_courts CT on (CT.ids = S.ids && CT.ordre = S.court)
INNER JOIN `coupes_rencontres` CR on CR.id = M.idt
INNER JOIN `coupes` C on C.id = CR.coupe_id
INNER JOIN tournois_name N on N.id = C.id
LEFT JOIN lieux_sites SL on SL.id = CR.lieu
LEFT JOIN lieux_villes SC on SC.id = SL.idv
LEFT JOIN lieux_pays SCO on SCO.code = SC.pays
LEFT JOIN `lieux_pays` T1 ON (T1.code = CR.equipe_domicile)
LEFT JOIN `lieux_pays` T2 ON (T2.code = CR.equipe_exterieur)
WHERE
M.id = '4063829'
&& M.type_tournoi_add = 1
&& (S.statut = 0 || S.statut = 4 || S.statut = 2 || ISNULL(S.statut))
UNION
SELECT
M.*
, M.time_start time_start
, M.time time_end
, M.duration_pause
, M.type_match_add type_match
, M.type_tournoi_add type_tournament
, '' level
, M.qualif
, M.idw winner_id
, P1.id p1_id
, P1.nom p1_name
, P1.prenom p1_first_name
, P1.name_zh p1_name_zh
, P1.birthday p1_birthday
, P1.sexe p1_gender
, P1.nat p1_nat
, P1.photo p1_photo
, P1.taille p1_height
, P1.poids p1_weight
, R1.rank p1_rank
, R1.liveRank p1_rank_live
, P1.pro_depuis p1_turn_pro
, '?' p1_best_rank
, P1.prise p1_forehand
, P1.revers p1_backhand
, M.ts1 p1_seed
, P1B.id p1b_id
, P1B.nom p1b_name
, P1B.prenom p1b_first_name
, P1B.name_zh p1b_name_zh
, P1B.birthday p1b_birthday
, P1B.sexe p1b_gender
, P1B.nat p1b_nat
, P1B.photo p1b_photo
, P1B.taille p1b_height
, P1B.poids p1b_weight
, R1B.rank p1b_rank
, R1B.liveRank p1b_rank_live
, P1B.pro_depuis p1b_turn_pro
, P2.id p2_id
, P2.nom p2_name
, P2.prenom p2_first_name
, P2.name_zh p2_name_zh
, P2.birthday p2_birthday
, P2.sexe p2_gender
, P2.nat p2_nat
, P2.photo p2_photo
, P2.taille p2_height
, P2.poids p2_weight
, R2.rank p2_rank
, R2.liveRank p2_rank_live
, P2.pro_depuis p2_turn_pro
, '?' p2_best_rank
, P2.prise p2_forehand
, P2.revers p2_backhand
, M.ts2 p2_seed
, P2B.id p2b_id
, P2B.nom p2b_name
, P2B.prenom p2b_first_name
, P2B.name_zh p2b_name_zh
, P2B.birthday p2b_birthday
, P2B.sexe p2b_gender
, P2B.nat p2b_nat
, P2B.photo p2b_photo
, P2B.taille p2b_height
, P2B.poids p2b_weight
, R2B.rank p2b_rank
, R2B.liveRank p2b_rank_live
, P2B.pro_depuis p2b_turn_pro
, L.id tournament_id
, 0 tournament_idt
, LR.id rencontre_id
, N.name_fr tournament_name_fr
, N.name_en tournament_name_en
, N.name_zh tournament_name_zh
, N.name_de tournament_name_de
, N.name_es tournament_name_es
, SC.nom tournament_city
, '' tournament_stadium
, '3' tournament_surface
, '' tournament_surface_photo
, '0' tournament_surface_color
, '' tournament_currency
, '' tournament_prize_money
, SCO.nom_fr tournament_country
, '' tournament_logo
, L.time_start tournament_start
, '' tournament_end
, '' tournament_nbPlayer
, '' tournament_genre
, '' tournament_category
, '' tournament_type
, LR.site tournament_site
, L.year tournament_year
, 0 tournament_importance
, '' team1
, '' team2
, 3 importance
, '' tournament_background
, SC.fuseau_horaire
, IF(ISNULL(LS.status) || M.status = 2 || M.status = 3 || M.status = 4, M.status, LS.status) match_status
, LS.serve
, S.time s_time_start
, S.court
, S.date_loc
, S.type s_type
, S.ordre s_order
, CT.nom court_name
, CT.ordre court_order
FROM
tournois_matchs M
JOIN joueurs P1 on P1.id = M.j1
LEFT JOIN `joueurs` P1B on P1B.id = M.j1_bis
JOIN joueurs P2 on P2.id = M.j2
LEFT JOIN `joueurs` P2B on P2B.id = M.j2_bis
LEFT JOIN tennis_rankings R1 on R1.player = P1.id AND R1.id = IF(P1.sexe = 1, 'wta', 'atp')
LEFT JOIN tennis_rankings R1B on R1B.player = P1B.id AND R1B.id = IF(P1B.sexe = 1, 'wta', 'atp')
LEFT JOIN tennis_rankings R2 on R2.player = P2.id AND R2.id = IF(P2.sexe = 1, 'wta', 'atp')
LEFT JOIN tennis_rankings R2B on R2B.player = P2B.id AND R2B.id = IF(P2B.sexe = 1, 'wta', 'atp')
LEFT JOIN `livescores_new`.`matchs` LS ON (LS.tt_match_id = M.id)
LEFT JOIN tournois_programmes S on S.idm = M.id
LEFT JOIN lieux_courts CT on (CT.ids = S.ids && CT.ordre = S.court)
JOIN `leagues_rounds` LR on LR.id = M.league_round
JOIN `leagues` L on L.id = LR.league
JOIN tournois_name N on N.league = L.id
LEFT JOIN lieux_sites SL on SL.id = LR.site
LEFT JOIN lieux_villes SC on SC.id = SL.idv
LEFT JOIN lieux_pays SCO on SCO.code = SC.pays
WHERE
M.id = '4063829'
&& M.type_tournoi_add = 2
&& (S.statut = 0 || S.statut = 4 || S.statut = 2 || ISNULL(S.statut))
LIMIT 1
SELECT M.*
, M.time_start time_start
, M.time time_end
, M.duration_pause
, M.type_match_add type_match
, M.type_tournoi_add type_tournament
, M.niveau level
, M.qualif
, M.idw winner_id
, P1.id p1_id
, P1.nom p1_name
, P1.prenom p1_first_name
, P1.name_zh p1_name_zh
, P1.birthday p1_birthday
, P1.sexe p1_gender
, P1.nat p1_nat
, P1.photo p1_photo
, P1.taille p1_height
, P1.poids p1_weight
, R1.rank p1_rank
, R1.liveRank p1_rank_live
, P1.pro_depuis p1_turn_pro
, '?' p1_best_rank
, P1.prise p1_forehand
, P1.revers p1_backhand
, M.ts1 p1_seed
, P1B.id p1b_id
, P1B.nom p1b_name
, P1B.prenom p1b_first_name
, P1B.name_zh p1b_name_zh
, P1B.birthday p1b_birthday
, P1B.sexe p1b_gender
, P1B.nat p1b_nat
, P1B.photo p1b_photo
, P1B.taille p1b_height
, P1B.poids p1b_weight
, R1B.rank p1b_rank
, R1B.liveRank p1b_rank_live
, P1B.pro_depuis p1b_turn_pro
, P2.id p2_id
, P2.nom p2_name
, P2.prenom p2_first_name
, P2.name_zh p2_name_zh
, P2.birthday p2_birthday
, P2.sexe p2_gender
, P2.nat p2_nat
, P2.photo p2_photo
, P2.taille p2_height
, P2.poids p2_weight
, R2.rank p2_rank
, R2.liveRank p2_rank_live
, P2.pro_depuis p2_turn_pro
, '?' p2_best_rank
, P2.prise p2_forehand
, P2.revers p2_backhand
, M.ts2 p2_seed
, P2B.id p2b_id
, P2B.nom p2b_name
, P2B.prenom p2b_first_name
, P2B.name_zh p2b_name_zh
, P2B.birthday p2b_birthday
, P2B.sexe p2b_gender
, P2B.nat p2b_nat
, P2B.photo p2b_photo
, P2B.taille p2b_height
, P2B.poids p2b_weight
, R2B.rank p2b_rank
, R2B.liveRank p2b_rank_live
, P2B.pro_depuis p2b_turn_pro
, T.id tournament_id
, T.idt tournament_idt
, '?' rencontre_id
, N.name_fr tournament_name_fr
, N.name_en tournament_name_en
, N.name_zh tournament_name_zh
, N.name_de tournament_name_de
, N.name_es tournament_name_es
, T.ville tournament_city
, T.stade tournament_stadium
, T.surface tournament_surface
, T.surface_photo tournament_surface_photo
, T.surface_color tournament_surface_color
, T.monnaie tournament_currency
, T.prix tournament_prize_money
, SCO.nom_fr tournament_country
, T.logo tournament_logo
, T.debut tournament_start
, T.fin tournament_end
, T.nbj tournament_nbPlayer
, T.genre tournament_genre
, T.category tournament_category
, T.type tournament_type
, T.ids tournament_site
, T.year tournament_year
, T.importance tournament_importance
, '' team1
, '' team2
, T.importance
, T.background tournament_background
, SC.fuseau_horaire
, IF(ISNULL(LS.status) || M.status = 2 || M.status = 3 || M.status = 4, M.status, LS.status) match_status
, LS.serve
, S.time s_time_start
, S.court
, S.date_loc
, S.type s_type
, S.ordre s_order
, C.nom court_name
, C.ordre court_order
FROM
tournois_matchs M
INNER JOIN joueurs P1 on P1.id = M.j1
LEFT OUTER JOIN `joueurs` P1B on P1B.id = M.j1_bis
INNER JOIN joueurs P2 on P2.id = M.j2
LEFT OUTER JOIN `joueurs` P2B on P2B.id = M.j2_bis
LEFT JOIN tennis_rankings R1 on R1.player = P1.id AND R1.id = IF(P1.sexe = 1, 'wta', 'atp')
LEFT JOIN tennis_rankings R1B on R1B.player = P1B.id AND R1B.id = IF(P1B.sexe = 1, 'wta', 'atp')
LEFT JOIN tennis_rankings R2 on R2.player = P2.id AND R2.id = IF(P2.sexe = 1, 'wta', 'atp')
LEFT JOIN tennis_rankings R2B on R2B.player = P2B.id AND R2B.id = IF(P2B.sexe = 1, 'wta', 'atp')
INNER JOIN tournois T on T.id = M.idt
INNER JOIN tournois_name N on N.id = T.id && N.cup = 0
LEFT OUTER JOIN lieux_sites SL on T.ids = SL.id
LEFT OUTER JOIN lieux_villes SC on SL.idv = SC.id
LEFT OUTER JOIN lieux_pays SCO on SCO.code = SC.pays
LEFT OUTER JOIN `livescores_new`.`matchs` LS on LS.tt_match_id = M.id
LEFT OUTER JOIN tournois_programmes S on S.idm = M.id
LEFT OUTER JOIN lieux_courts C on C.ids = S.ids && C.ordre = S.court
WHERE
M.id = '4063810'
&& M.type_tournoi_add = 0
&& (S.statut = 0 || S.statut = 4 || S.statut = 2 || ISNULL(S.statut))
UNION
SELECT
M.*
, M.time_start time_start
, M.time time_end
, M.duration_pause
, M.type_match_add type_match
, M.type_tournoi_add type_tournament
, CR.niveau level
, M.qualif
, M.idw winner_id
, P1.id p1_id
, P1.nom p1_name
, P1.prenom p1_first_name
, P1.name_zh p1_name_zh
, P1.birthday p1_birthday
, P1.sexe p1_gender
, P1.nat p1_nat
, P1.photo p1_photo
, P1.taille p1_height
, P1.poids p1_weight
, R1.rank p1_rank
, R1.liveRank p1_rank_live
, P1.pro_depuis p1_turn_pro
, '?' p1_best_rank
, P1.prise p1_forehand
, P1.revers p1_backhand
, M.ts1 p1_seed
, P1B.id p1b_id
, P1B.nom p1b_name
, P1B.prenom p1b_first_name
, P1B.name_zh p1b_name_zh
, P1B.birthday p1b_birthday
, P1B.sexe p1b_gender
, P1B.nat p1b_nat
, P1B.photo p1b_photo
, P1B.taille p1b_height
, P1B.poids p1b_weight
, R1B.rank p1b_rank
, R1B.liveRank p1b_rank_live
, P1B.pro_depuis p1b_turn_pro
, P2.id p2_id
, P2.nom p2_name
, P2.prenom p2_first_name
, P2.name_zh p2_name_zh
, P2.birthday p2_birthday
, P2.sexe p2_gender
, P2.nat p2_nat
, P2.photo p2_photo
, P2.taille p2_height
, P2.poids p2_weight
, R2.rank p2_rank
, R2.liveRank p2_rank_live
, P2.pro_depuis p2_turn_pro
, '?' p2_best_rank
, P2.prise p2_forehand
, P2.revers p2_backhand
, M.ts2 p2_seed
, P2B.id p2b_id
, P2B.nom p2b_name
, P2B.prenom p2b_first_name
, P2B.name_zh p2b_name_zh
, P2B.birthday p2b_birthday
, P2B.sexe p2b_gender
, P2B.nat p2b_nat
, P2B.photo p2b_photo
, P2B.taille p2b_height
, P2B.poids p2b_weight
, R2B.rank p2b_rank
, R2B.liveRank p2b_rank_live
, P2B.pro_depuis p2b_turn_pro
, C.id tournament_id
, C.parent tournament_idt
, CR.id rencontre_id
, N.name_fr tournament_name_fr
, N.name_en tournament_name_en
, N.name_zh tournament_name_zh
, N.name_de tournament_name_de
, N.name_es tournament_name_es
, CONCAT(CR.equipe_domicile, '|', CR.equipe_exterieur) tournament_city
, '' tournament_stadium
, CR.surface tournament_surface
, '' tournament_surface_photo
, '0' tournament_surface_color
, '' tournament_currency
, '' tournament_prize_money
, SCO.nom_fr tournament_country
, '' tournament_logo
, CR.date_d tournament_start
, '' tournament_end
, C.nbj tournament_nbPlayer
, '' tournament_genre
, '' tournament_category
, '' tournament_type
, CR.lieu tournament_site
, '' tournament_year
, 65 tournament_importance
, IF(T1.nom_fr, T1.nom_fr, CR.equipe_domicile) team1
, IF(T2.nom_fr, T1.nom_fr, CR.equipe_exterieur) team2
, 65 importance
, '' tournament_background
, SC.fuseau_horaire
, IF(ISNULL(LS.status) || M.status = 2 || M.status = 3 || M.status = 4, M.status, LS.status) match_status
, LS.serve
, S.time s_time_start
, S.court
, S.date_loc
, S.type s_type
, S.ordre s_order
, CT.nom court_name
, CT.ordre court_order
FROM
tournois_matchs M
INNER JOIN joueurs P1 on P1.id = M.j1
LEFT OUTER JOIN `joueurs` P1B on P1B.id = M.j1_bis
INNER JOIN joueurs P2 on P2.id = M.j2
LEFT OUTER JOIN `joueurs` P2B on P2B.id = M.j2_bis
LEFT JOIN tennis_rankings R1 on R1.player = P1.id AND R1.id = IF(P1.sexe = 1, 'wta', 'atp')
LEFT JOIN tennis_rankings R1B on R1B.player = P1B.id AND R1B.id = IF(P1B.sexe = 1, 'wta', 'atp')
LEFT JOIN tennis_rankings R2 on R2.player = P2.id AND R2.id = IF(P2.sexe = 1, 'wta', 'atp')
LEFT JOIN tennis_rankings R2B on R2B.player = P2B.id AND R2B.id = IF(P2B.sexe = 1, 'wta', 'atp')
LEFT OUTER JOIN `livescores_new`.`matchs` LS ON (LS.tt_match_id = M.id)
LEFT OUTER JOIN tournois_programmes S on S.idm = M.id
LEFT OUTER JOIN lieux_courts CT on (CT.ids = S.ids && CT.ordre = S.court)
INNER JOIN `coupes_rencontres` CR on CR.id = M.idt
INNER JOIN `coupes` C on C.id = CR.coupe_id
INNER JOIN tournois_name N on N.id = C.id
LEFT JOIN lieux_sites SL on SL.id = CR.lieu
LEFT JOIN lieux_villes SC on SC.id = SL.idv
LEFT JOIN lieux_pays SCO on SCO.code = SC.pays
LEFT JOIN `lieux_pays` T1 ON (T1.code = CR.equipe_domicile)
LEFT JOIN `lieux_pays` T2 ON (T2.code = CR.equipe_exterieur)
WHERE
M.id = '4063810'
&& M.type_tournoi_add = 1
&& (S.statut = 0 || S.statut = 4 || S.statut = 2 || ISNULL(S.statut))
UNION
SELECT
M.*
, M.time_start time_start
, M.time time_end
, M.duration_pause
, M.type_match_add type_match
, M.type_tournoi_add type_tournament
, '' level
, M.qualif
, M.idw winner_id
, P1.id p1_id
, P1.nom p1_name
, P1.prenom p1_first_name
, P1.name_zh p1_name_zh
, P1.birthday p1_birthday
, P1.sexe p1_gender
, P1.nat p1_nat
, P1.photo p1_photo
, P1.taille p1_height
, P1.poids p1_weight
, R1.rank p1_rank
, R1.liveRank p1_rank_live
, P1.pro_depuis p1_turn_pro
, '?' p1_best_rank
, P1.prise p1_forehand
, P1.revers p1_backhand
, M.ts1 p1_seed
, P1B.id p1b_id
, P1B.nom p1b_name
, P1B.prenom p1b_first_name
, P1B.name_zh p1b_name_zh
, P1B.birthday p1b_birthday
, P1B.sexe p1b_gender
, P1B.nat p1b_nat
, P1B.photo p1b_photo
, P1B.taille p1b_height
, P1B.poids p1b_weight
, R1B.rank p1b_rank
, R1B.liveRank p1b_rank_live
, P1B.pro_depuis p1b_turn_pro
, P2.id p2_id
, P2.nom p2_name
, P2.prenom p2_first_name
, P2.name_zh p2_name_zh
, P2.birthday p2_birthday
, P2.sexe p2_gender
, P2.nat p2_nat
, P2.photo p2_photo
, P2.taille p2_height
, P2.poids p2_weight
, R2.rank p2_rank
, R2.liveRank p2_rank_live
, P2.pro_depuis p2_turn_pro
, '?' p2_best_rank
, P2.prise p2_forehand
, P2.revers p2_backhand
, M.ts2 p2_seed
, P2B.id p2b_id
, P2B.nom p2b_name
, P2B.prenom p2b_first_name
, P2B.name_zh p2b_name_zh
, P2B.birthday p2b_birthday
, P2B.sexe p2b_gender
, P2B.nat p2b_nat
, P2B.photo p2b_photo
, P2B.taille p2b_height
, P2B.poids p2b_weight
, R2B.rank p2b_rank
, R2B.liveRank p2b_rank_live
, P2B.pro_depuis p2b_turn_pro
, L.id tournament_id
, 0 tournament_idt
, LR.id rencontre_id
, N.name_fr tournament_name_fr
, N.name_en tournament_name_en
, N.name_zh tournament_name_zh
, N.name_de tournament_name_de
, N.name_es tournament_name_es
, SC.nom tournament_city
, '' tournament_stadium
, '3' tournament_surface
, '' tournament_surface_photo
, '0' tournament_surface_color
, '' tournament_currency
, '' tournament_prize_money
, SCO.nom_fr tournament_country
, '' tournament_logo
, L.time_start tournament_start
, '' tournament_end
, '' tournament_nbPlayer
, '' tournament_genre
, '' tournament_category
, '' tournament_type
, LR.site tournament_site
, L.year tournament_year
, 0 tournament_importance
, '' team1
, '' team2
, 3 importance
, '' tournament_background
, SC.fuseau_horaire
, IF(ISNULL(LS.status) || M.status = 2 || M.status = 3 || M.status = 4, M.status, LS.status) match_status
, LS.serve
, S.time s_time_start
, S.court
, S.date_loc
, S.type s_type
, S.ordre s_order
, CT.nom court_name
, CT.ordre court_order
FROM
tournois_matchs M
JOIN joueurs P1 on P1.id = M.j1
LEFT JOIN `joueurs` P1B on P1B.id = M.j1_bis
JOIN joueurs P2 on P2.id = M.j2
LEFT JOIN `joueurs` P2B on P2B.id = M.j2_bis
LEFT JOIN tennis_rankings R1 on R1.player = P1.id AND R1.id = IF(P1.sexe = 1, 'wta', 'atp')
LEFT JOIN tennis_rankings R1B on R1B.player = P1B.id AND R1B.id = IF(P1B.sexe = 1, 'wta', 'atp')
LEFT JOIN tennis_rankings R2 on R2.player = P2.id AND R2.id = IF(P2.sexe = 1, 'wta', 'atp')
LEFT JOIN tennis_rankings R2B on R2B.player = P2B.id AND R2B.id = IF(P2B.sexe = 1, 'wta', 'atp')
LEFT JOIN `livescores_new`.`matchs` LS ON (LS.tt_match_id = M.id)
LEFT JOIN tournois_programmes S on S.idm = M.id
LEFT JOIN lieux_courts CT on (CT.ids = S.ids && CT.ordre = S.court)
JOIN `leagues_rounds` LR on LR.id = M.league_round
JOIN `leagues` L on L.id = LR.league
JOIN tournois_name N on N.league = L.id
LEFT JOIN lieux_sites SL on SL.id = LR.site
LEFT JOIN lieux_villes SC on SC.id = SL.idv
LEFT JOIN lieux_pays SCO on SCO.code = SC.pays
WHERE
M.id = '4063810'
&& M.type_tournoi_add = 2
&& (S.statut = 0 || S.statut = 4 || S.statut = 2 || ISNULL(S.statut))
LIMIT 1
SELECT M.*
, M.time_start time_start
, M.time time_end
, M.duration_pause
, M.type_match_add type_match
, M.type_tournoi_add type_tournament
, M.niveau level
, M.qualif
, M.idw winner_id
, P1.id p1_id
, P1.nom p1_name
, P1.prenom p1_first_name
, P1.name_zh p1_name_zh
, P1.birthday p1_birthday
, P1.sexe p1_gender
, P1.nat p1_nat
, P1.photo p1_photo
, P1.taille p1_height
, P1.poids p1_weight
, R1.rank p1_rank
, R1.liveRank p1_rank_live
, P1.pro_depuis p1_turn_pro
, '?' p1_best_rank
, P1.prise p1_forehand
, P1.revers p1_backhand
, M.ts1 p1_seed
, P1B.id p1b_id
, P1B.nom p1b_name
, P1B.prenom p1b_first_name
, P1B.name_zh p1b_name_zh
, P1B.birthday p1b_birthday
, P1B.sexe p1b_gender
, P1B.nat p1b_nat
, P1B.photo p1b_photo
, P1B.taille p1b_height
, P1B.poids p1b_weight
, R1B.rank p1b_rank
, R1B.liveRank p1b_rank_live
, P1B.pro_depuis p1b_turn_pro
, P2.id p2_id
, P2.nom p2_name
, P2.prenom p2_first_name
, P2.name_zh p2_name_zh
, P2.birthday p2_birthday
, P2.sexe p2_gender
, P2.nat p2_nat
, P2.photo p2_photo
, P2.taille p2_height
, P2.poids p2_weight
, R2.rank p2_rank
, R2.liveRank p2_rank_live
, P2.pro_depuis p2_turn_pro
, '?' p2_best_rank
, P2.prise p2_forehand
, P2.revers p2_backhand
, M.ts2 p2_seed
, P2B.id p2b_id
, P2B.nom p2b_name
, P2B.prenom p2b_first_name
, P2B.name_zh p2b_name_zh
, P2B.birthday p2b_birthday
, P2B.sexe p2b_gender
, P2B.nat p2b_nat
, P2B.photo p2b_photo
, P2B.taille p2b_height
, P2B.poids p2b_weight
, R2B.rank p2b_rank
, R2B.liveRank p2b_rank_live
, P2B.pro_depuis p2b_turn_pro
, T.id tournament_id
, T.idt tournament_idt
, '?' rencontre_id
, N.name_fr tournament_name_fr
, N.name_en tournament_name_en
, N.name_zh tournament_name_zh
, N.name_de tournament_name_de
, N.name_es tournament_name_es
, T.ville tournament_city
, T.stade tournament_stadium
, T.surface tournament_surface
, T.surface_photo tournament_surface_photo
, T.surface_color tournament_surface_color
, T.monnaie tournament_currency
, T.prix tournament_prize_money
, SCO.nom_fr tournament_country
, T.logo tournament_logo
, T.debut tournament_start
, T.fin tournament_end
, T.nbj tournament_nbPlayer
, T.genre tournament_genre
, T.category tournament_category
, T.type tournament_type
, T.ids tournament_site
, T.year tournament_year
, T.importance tournament_importance
, '' team1
, '' team2
, T.importance
, T.background tournament_background
, SC.fuseau_horaire
, IF(ISNULL(LS.status) || M.status = 2 || M.status = 3 || M.status = 4, M.status, LS.status) match_status
, LS.serve
, S.time s_time_start
, S.court
, S.date_loc
, S.type s_type
, S.ordre s_order
, C.nom court_name
, C.ordre court_order
FROM
tournois_matchs M
INNER JOIN joueurs P1 on P1.id = M.j1
LEFT OUTER JOIN `joueurs` P1B on P1B.id = M.j1_bis
INNER JOIN joueurs P2 on P2.id = M.j2
LEFT OUTER JOIN `joueurs` P2B on P2B.id = M.j2_bis
LEFT JOIN tennis_rankings R1 on R1.player = P1.id AND R1.id = IF(P1.sexe = 1, 'wta', 'atp')
LEFT JOIN tennis_rankings R1B on R1B.player = P1B.id AND R1B.id = IF(P1B.sexe = 1, 'wta', 'atp')
LEFT JOIN tennis_rankings R2 on R2.player = P2.id AND R2.id = IF(P2.sexe = 1, 'wta', 'atp')
LEFT JOIN tennis_rankings R2B on R2B.player = P2B.id AND R2B.id = IF(P2B.sexe = 1, 'wta', 'atp')
INNER JOIN tournois T on T.id = M.idt
INNER JOIN tournois_name N on N.id = T.id && N.cup = 0
LEFT OUTER JOIN lieux_sites SL on T.ids = SL.id
LEFT OUTER JOIN lieux_villes SC on SL.idv = SC.id
LEFT OUTER JOIN lieux_pays SCO on SCO.code = SC.pays
LEFT OUTER JOIN `livescores_new`.`matchs` LS on LS.tt_match_id = M.id
LEFT OUTER JOIN tournois_programmes S on S.idm = M.id
LEFT OUTER JOIN lieux_courts C on C.ids = S.ids && C.ordre = S.court
WHERE
M.id = '4063835'
&& M.type_tournoi_add = 0
&& (S.statut = 0 || S.statut = 4 || S.statut = 2 || ISNULL(S.statut))
UNION
SELECT
M.*
, M.time_start time_start
, M.time time_end
, M.duration_pause
, M.type_match_add type_match
, M.type_tournoi_add type_tournament
, CR.niveau level
, M.qualif
, M.idw winner_id
, P1.id p1_id
, P1.nom p1_name
, P1.prenom p1_first_name
, P1.name_zh p1_name_zh
, P1.birthday p1_birthday
, P1.sexe p1_gender
, P1.nat p1_nat
, P1.photo p1_photo
, P1.taille p1_height
, P1.poids p1_weight
, R1.rank p1_rank
, R1.liveRank p1_rank_live
, P1.pro_depuis p1_turn_pro
, '?' p1_best_rank
, P1.prise p1_forehand
, P1.revers p1_backhand
, M.ts1 p1_seed
, P1B.id p1b_id
, P1B.nom p1b_name
, P1B.prenom p1b_first_name
, P1B.name_zh p1b_name_zh
, P1B.birthday p1b_birthday
, P1B.sexe p1b_gender
, P1B.nat p1b_nat
, P1B.photo p1b_photo
, P1B.taille p1b_height
, P1B.poids p1b_weight
, R1B.rank p1b_rank
, R1B.liveRank p1b_rank_live
, P1B.pro_depuis p1b_turn_pro
, P2.id p2_id
, P2.nom p2_name
, P2.prenom p2_first_name
, P2.name_zh p2_name_zh
, P2.birthday p2_birthday
, P2.sexe p2_gender
, P2.nat p2_nat
, P2.photo p2_photo
, P2.taille p2_height
, P2.poids p2_weight
, R2.rank p2_rank
, R2.liveRank p2_rank_live
, P2.pro_depuis p2_turn_pro
, '?' p2_best_rank
, P2.prise p2_forehand
, P2.revers p2_backhand
, M.ts2 p2_seed
, P2B.id p2b_id
, P2B.nom p2b_name
, P2B.prenom p2b_first_name
, P2B.name_zh p2b_name_zh
, P2B.birthday p2b_birthday
, P2B.sexe p2b_gender
, P2B.nat p2b_nat
, P2B.photo p2b_photo
, P2B.taille p2b_height
, P2B.poids p2b_weight
, R2B.rank p2b_rank
, R2B.liveRank p2b_rank_live
, P2B.pro_depuis p2b_turn_pro
, C.id tournament_id
, C.parent tournament_idt
, CR.id rencontre_id
, N.name_fr tournament_name_fr
, N.name_en tournament_name_en
, N.name_zh tournament_name_zh
, N.name_de tournament_name_de
, N.name_es tournament_name_es
, CONCAT(CR.equipe_domicile, '|', CR.equipe_exterieur) tournament_city
, '' tournament_stadium
, CR.surface tournament_surface
, '' tournament_surface_photo
, '0' tournament_surface_color
, '' tournament_currency
, '' tournament_prize_money
, SCO.nom_fr tournament_country
, '' tournament_logo
, CR.date_d tournament_start
, '' tournament_end
, C.nbj tournament_nbPlayer
, '' tournament_genre
, '' tournament_category
, '' tournament_type
, CR.lieu tournament_site
, '' tournament_year
, 65 tournament_importance
, IF(T1.nom_fr, T1.nom_fr, CR.equipe_domicile) team1
, IF(T2.nom_fr, T1.nom_fr, CR.equipe_exterieur) team2
, 65 importance
, '' tournament_background
, SC.fuseau_horaire
, IF(ISNULL(LS.status) || M.status = 2 || M.status = 3 || M.status = 4, M.status, LS.status) match_status
, LS.serve
, S.time s_time_start
, S.court
, S.date_loc
, S.type s_type
, S.ordre s_order
, CT.nom court_name
, CT.ordre court_order
FROM
tournois_matchs M
INNER JOIN joueurs P1 on P1.id = M.j1
LEFT OUTER JOIN `joueurs` P1B on P1B.id = M.j1_bis
INNER JOIN joueurs P2 on P2.id = M.j2
LEFT OUTER JOIN `joueurs` P2B on P2B.id = M.j2_bis
LEFT JOIN tennis_rankings R1 on R1.player = P1.id AND R1.id = IF(P1.sexe = 1, 'wta', 'atp')
LEFT JOIN tennis_rankings R1B on R1B.player = P1B.id AND R1B.id = IF(P1B.sexe = 1, 'wta', 'atp')
LEFT JOIN tennis_rankings R2 on R2.player = P2.id AND R2.id = IF(P2.sexe = 1, 'wta', 'atp')
LEFT JOIN tennis_rankings R2B on R2B.player = P2B.id AND R2B.id = IF(P2B.sexe = 1, 'wta', 'atp')
LEFT OUTER JOIN `livescores_new`.`matchs` LS ON (LS.tt_match_id = M.id)
LEFT OUTER JOIN tournois_programmes S on S.idm = M.id
LEFT OUTER JOIN lieux_courts CT on (CT.ids = S.ids && CT.ordre = S.court)
INNER JOIN `coupes_rencontres` CR on CR.id = M.idt
INNER JOIN `coupes` C on C.id = CR.coupe_id
INNER JOIN tournois_name N on N.id = C.id
LEFT JOIN lieux_sites SL on SL.id = CR.lieu
LEFT JOIN lieux_villes SC on SC.id = SL.idv
LEFT JOIN lieux_pays SCO on SCO.code = SC.pays
LEFT JOIN `lieux_pays` T1 ON (T1.code = CR.equipe_domicile)
LEFT JOIN `lieux_pays` T2 ON (T2.code = CR.equipe_exterieur)
WHERE
M.id = '4063835'
&& M.type_tournoi_add = 1
&& (S.statut = 0 || S.statut = 4 || S.statut = 2 || ISNULL(S.statut))
UNION
SELECT
M.*
, M.time_start time_start
, M.time time_end
, M.duration_pause
, M.type_match_add type_match
, M.type_tournoi_add type_tournament
, '' level
, M.qualif
, M.idw winner_id
, P1.id p1_id
, P1.nom p1_name
, P1.prenom p1_first_name
, P1.name_zh p1_name_zh
, P1.birthday p1_birthday
, P1.sexe p1_gender
, P1.nat p1_nat
, P1.photo p1_photo
, P1.taille p1_height
, P1.poids p1_weight
, R1.rank p1_rank
, R1.liveRank p1_rank_live
, P1.pro_depuis p1_turn_pro
, '?' p1_best_rank
, P1.prise p1_forehand
, P1.revers p1_backhand
, M.ts1 p1_seed
, P1B.id p1b_id
, P1B.nom p1b_name
, P1B.prenom p1b_first_name
, P1B.name_zh p1b_name_zh
, P1B.birthday p1b_birthday
, P1B.sexe p1b_gender
, P1B.nat p1b_nat
, P1B.photo p1b_photo
, P1B.taille p1b_height
, P1B.poids p1b_weight
, R1B.rank p1b_rank
, R1B.liveRank p1b_rank_live
, P1B.pro_depuis p1b_turn_pro
, P2.id p2_id
, P2.nom p2_name
, P2.prenom p2_first_name
, P2.name_zh p2_name_zh
, P2.birthday p2_birthday
, P2.sexe p2_gender
, P2.nat p2_nat
, P2.photo p2_photo
, P2.taille p2_height
, P2.poids p2_weight
, R2.rank p2_rank
, R2.liveRank p2_rank_live
, P2.pro_depuis p2_turn_pro
, '?' p2_best_rank
, P2.prise p2_forehand
, P2.revers p2_backhand
, M.ts2 p2_seed
, P2B.id p2b_id
, P2B.nom p2b_name
, P2B.prenom p2b_first_name
, P2B.name_zh p2b_name_zh
, P2B.birthday p2b_birthday
, P2B.sexe p2b_gender
, P2B.nat p2b_nat
, P2B.photo p2b_photo
, P2B.taille p2b_height
, P2B.poids p2b_weight
, R2B.rank p2b_rank
, R2B.liveRank p2b_rank_live
, P2B.pro_depuis p2b_turn_pro
, L.id tournament_id
, 0 tournament_idt
, LR.id rencontre_id
, N.name_fr tournament_name_fr
, N.name_en tournament_name_en
, N.name_zh tournament_name_zh
, N.name_de tournament_name_de
, N.name_es tournament_name_es
, SC.nom tournament_city
, '' tournament_stadium
, '3' tournament_surface
, '' tournament_surface_photo
, '0' tournament_surface_color
, '' tournament_currency
, '' tournament_prize_money
, SCO.nom_fr tournament_country
, '' tournament_logo
, L.time_start tournament_start
, '' tournament_end
, '' tournament_nbPlayer
, '' tournament_genre
, '' tournament_category
, '' tournament_type
, LR.site tournament_site
, L.year tournament_year
, 0 tournament_importance
, '' team1
, '' team2
, 3 importance
, '' tournament_background
, SC.fuseau_horaire
, IF(ISNULL(LS.status) || M.status = 2 || M.status = 3 || M.status = 4, M.status, LS.status) match_status
, LS.serve
, S.time s_time_start
, S.court
, S.date_loc
, S.type s_type
, S.ordre s_order
, CT.nom court_name
, CT.ordre court_order
FROM
tournois_matchs M
JOIN joueurs P1 on P1.id = M.j1
LEFT JOIN `joueurs` P1B on P1B.id = M.j1_bis
JOIN joueurs P2 on P2.id = M.j2
LEFT JOIN `joueurs` P2B on P2B.id = M.j2_bis
LEFT JOIN tennis_rankings R1 on R1.player = P1.id AND R1.id = IF(P1.sexe = 1, 'wta', 'atp')
LEFT JOIN tennis_rankings R1B on R1B.player = P1B.id AND R1B.id = IF(P1B.sexe = 1, 'wta', 'atp')
LEFT JOIN tennis_rankings R2 on R2.player = P2.id AND R2.id = IF(P2.sexe = 1, 'wta', 'atp')
LEFT JOIN tennis_rankings R2B on R2B.player = P2B.id AND R2B.id = IF(P2B.sexe = 1, 'wta', 'atp')
LEFT JOIN `livescores_new`.`matchs` LS ON (LS.tt_match_id = M.id)
LEFT JOIN tournois_programmes S on S.idm = M.id
LEFT JOIN lieux_courts CT on (CT.ids = S.ids && CT.ordre = S.court)
JOIN `leagues_rounds` LR on LR.id = M.league_round
JOIN `leagues` L on L.id = LR.league
JOIN tournois_name N on N.league = L.id
LEFT JOIN lieux_sites SL on SL.id = LR.site
LEFT JOIN lieux_villes SC on SC.id = SL.idv
LEFT JOIN lieux_pays SCO on SCO.code = SC.pays
WHERE
M.id = '4063835'
&& M.type_tournoi_add = 2
&& (S.statut = 0 || S.statut = 4 || S.statut = 2 || ISNULL(S.statut))
LIMIT 1
SELECT M.*
, M.time_start time_start
, M.time time_end
, M.duration_pause
, M.type_match_add type_match
, M.type_tournoi_add type_tournament
, M.niveau level
, M.qualif
, M.idw winner_id
, P1.id p1_id
, P1.nom p1_name
, P1.prenom p1_first_name
, P1.name_zh p1_name_zh
, P1.birthday p1_birthday
, P1.sexe p1_gender
, P1.nat p1_nat
, P1.photo p1_photo
, P1.taille p1_height
, P1.poids p1_weight
, R1.rank p1_rank
, R1.liveRank p1_rank_live
, P1.pro_depuis p1_turn_pro
, '?' p1_best_rank
, P1.prise p1_forehand
, P1.revers p1_backhand
, M.ts1 p1_seed
, P1B.id p1b_id
, P1B.nom p1b_name
, P1B.prenom p1b_first_name
, P1B.name_zh p1b_name_zh
, P1B.birthday p1b_birthday
, P1B.sexe p1b_gender
, P1B.nat p1b_nat
, P1B.photo p1b_photo
, P1B.taille p1b_height
, P1B.poids p1b_weight
, R1B.rank p1b_rank
, R1B.liveRank p1b_rank_live
, P1B.pro_depuis p1b_turn_pro
, P2.id p2_id
, P2.nom p2_name
, P2.prenom p2_first_name
, P2.name_zh p2_name_zh
, P2.birthday p2_birthday
, P2.sexe p2_gender
, P2.nat p2_nat
, P2.photo p2_photo
, P2.taille p2_height
, P2.poids p2_weight
, R2.rank p2_rank
, R2.liveRank p2_rank_live
, P2.pro_depuis p2_turn_pro
, '?' p2_best_rank
, P2.prise p2_forehand
, P2.revers p2_backhand
, M.ts2 p2_seed
, P2B.id p2b_id
, P2B.nom p2b_name
, P2B.prenom p2b_first_name
, P2B.name_zh p2b_name_zh
, P2B.birthday p2b_birthday
, P2B.sexe p2b_gender
, P2B.nat p2b_nat
, P2B.photo p2b_photo
, P2B.taille p2b_height
, P2B.poids p2b_weight
, R2B.rank p2b_rank
, R2B.liveRank p2b_rank_live
, P2B.pro_depuis p2b_turn_pro
, T.id tournament_id
, T.idt tournament_idt
, '?' rencontre_id
, N.name_fr tournament_name_fr
, N.name_en tournament_name_en
, N.name_zh tournament_name_zh
, N.name_de tournament_name_de
, N.name_es tournament_name_es
, T.ville tournament_city
, T.stade tournament_stadium
, T.surface tournament_surface
, T.surface_photo tournament_surface_photo
, T.surface_color tournament_surface_color
, T.monnaie tournament_currency
, T.prix tournament_prize_money
, SCO.nom_fr tournament_country
, T.logo tournament_logo
, T.debut tournament_start
, T.fin tournament_end
, T.nbj tournament_nbPlayer
, T.genre tournament_genre
, T.category tournament_category
, T.type tournament_type
, T.ids tournament_site
, T.year tournament_year
, T.importance tournament_importance
, '' team1
, '' team2
, T.importance
, T.background tournament_background
, SC.fuseau_horaire
, IF(ISNULL(LS.status) || M.status = 2 || M.status = 3 || M.status = 4, M.status, LS.status) match_status
, LS.serve
, S.time s_time_start
, S.court
, S.date_loc
, S.type s_type
, S.ordre s_order
, C.nom court_name
, C.ordre court_order
FROM
tournois_matchs M
INNER JOIN joueurs P1 on P1.id = M.j1
LEFT OUTER JOIN `joueurs` P1B on P1B.id = M.j1_bis
INNER JOIN joueurs P2 on P2.id = M.j2
LEFT OUTER JOIN `joueurs` P2B on P2B.id = M.j2_bis
LEFT JOIN tennis_rankings R1 on R1.player = P1.id AND R1.id = IF(P1.sexe = 1, 'wta', 'atp')
LEFT JOIN tennis_rankings R1B on R1B.player = P1B.id AND R1B.id = IF(P1B.sexe = 1, 'wta', 'atp')
LEFT JOIN tennis_rankings R2 on R2.player = P2.id AND R2.id = IF(P2.sexe = 1, 'wta', 'atp')
LEFT JOIN tennis_rankings R2B on R2B.player = P2B.id AND R2B.id = IF(P2B.sexe = 1, 'wta', 'atp')
INNER JOIN tournois T on T.id = M.idt
INNER JOIN tournois_name N on N.id = T.id && N.cup = 0
LEFT OUTER JOIN lieux_sites SL on T.ids = SL.id
LEFT OUTER JOIN lieux_villes SC on SL.idv = SC.id
LEFT OUTER JOIN lieux_pays SCO on SCO.code = SC.pays
LEFT OUTER JOIN `livescores_new`.`matchs` LS on LS.tt_match_id = M.id
LEFT OUTER JOIN tournois_programmes S on S.idm = M.id
LEFT OUTER JOIN lieux_courts C on C.ids = S.ids && C.ordre = S.court
WHERE
M.id = '4063838'
&& M.type_tournoi_add = 0
&& (S.statut = 0 || S.statut = 4 || S.statut = 2 || ISNULL(S.statut))
UNION
SELECT
M.*
, M.time_start time_start
, M.time time_end
, M.duration_pause
, M.type_match_add type_match
, M.type_tournoi_add type_tournament
, CR.niveau level
, M.qualif
, M.idw winner_id
, P1.id p1_id
, P1.nom p1_name
, P1.prenom p1_first_name
, P1.name_zh p1_name_zh
, P1.birthday p1_birthday
, P1.sexe p1_gender
, P1.nat p1_nat
, P1.photo p1_photo
, P1.taille p1_height
, P1.poids p1_weight
, R1.rank p1_rank
, R1.liveRank p1_rank_live
, P1.pro_depuis p1_turn_pro
, '?' p1_best_rank
, P1.prise p1_forehand
, P1.revers p1_backhand
, M.ts1 p1_seed
, P1B.id p1b_id
, P1B.nom p1b_name
, P1B.prenom p1b_first_name
, P1B.name_zh p1b_name_zh
, P1B.birthday p1b_birthday
, P1B.sexe p1b_gender
, P1B.nat p1b_nat
, P1B.photo p1b_photo
, P1B.taille p1b_height
, P1B.poids p1b_weight
, R1B.rank p1b_rank
, R1B.liveRank p1b_rank_live
, P1B.pro_depuis p1b_turn_pro
, P2.id p2_id
, P2.nom p2_name
, P2.prenom p2_first_name
, P2.name_zh p2_name_zh
, P2.birthday p2_birthday
, P2.sexe p2_gender
, P2.nat p2_nat
, P2.photo p2_photo
, P2.taille p2_height
, P2.poids p2_weight
, R2.rank p2_rank
, R2.liveRank p2_rank_live
, P2.pro_depuis p2_turn_pro
, '?' p2_best_rank
, P2.prise p2_forehand
, P2.revers p2_backhand
, M.ts2 p2_seed
, P2B.id p2b_id
, P2B.nom p2b_name
, P2B.prenom p2b_first_name
, P2B.name_zh p2b_name_zh
, P2B.birthday p2b_birthday
, P2B.sexe p2b_gender
, P2B.nat p2b_nat
, P2B.photo p2b_photo
, P2B.taille p2b_height
, P2B.poids p2b_weight
, R2B.rank p2b_rank
, R2B.liveRank p2b_rank_live
, P2B.pro_depuis p2b_turn_pro
, C.id tournament_id
, C.parent tournament_idt
, CR.id rencontre_id
, N.name_fr tournament_name_fr
, N.name_en tournament_name_en
, N.name_zh tournament_name_zh
, N.name_de tournament_name_de
, N.name_es tournament_name_es
, CONCAT(CR.equipe_domicile, '|', CR.equipe_exterieur) tournament_city
, '' tournament_stadium
, CR.surface tournament_surface
, '' tournament_surface_photo
, '0' tournament_surface_color
, '' tournament_currency
, '' tournament_prize_money
, SCO.nom_fr tournament_country
, '' tournament_logo
, CR.date_d tournament_start
, '' tournament_end
, C.nbj tournament_nbPlayer
, '' tournament_genre
, '' tournament_category
, '' tournament_type
, CR.lieu tournament_site
, '' tournament_year
, 65 tournament_importance
, IF(T1.nom_fr, T1.nom_fr, CR.equipe_domicile) team1
, IF(T2.nom_fr, T1.nom_fr, CR.equipe_exterieur) team2
, 65 importance
, '' tournament_background
, SC.fuseau_horaire
, IF(ISNULL(LS.status) || M.status = 2 || M.status = 3 || M.status = 4, M.status, LS.status) match_status
, LS.serve
, S.time s_time_start
, S.court
, S.date_loc
, S.type s_type
, S.ordre s_order
, CT.nom court_name
, CT.ordre court_order
FROM
tournois_matchs M
INNER JOIN joueurs P1 on P1.id = M.j1
LEFT OUTER JOIN `joueurs` P1B on P1B.id = M.j1_bis
INNER JOIN joueurs P2 on P2.id = M.j2
LEFT OUTER JOIN `joueurs` P2B on P2B.id = M.j2_bis
LEFT JOIN tennis_rankings R1 on R1.player = P1.id AND R1.id = IF(P1.sexe = 1, 'wta', 'atp')
LEFT JOIN tennis_rankings R1B on R1B.player = P1B.id AND R1B.id = IF(P1B.sexe = 1, 'wta', 'atp')
LEFT JOIN tennis_rankings R2 on R2.player = P2.id AND R2.id = IF(P2.sexe = 1, 'wta', 'atp')
LEFT JOIN tennis_rankings R2B on R2B.player = P2B.id AND R2B.id = IF(P2B.sexe = 1, 'wta', 'atp')
LEFT OUTER JOIN `livescores_new`.`matchs` LS ON (LS.tt_match_id = M.id)
LEFT OUTER JOIN tournois_programmes S on S.idm = M.id
LEFT OUTER JOIN lieux_courts CT on (CT.ids = S.ids && CT.ordre = S.court)
INNER JOIN `coupes_rencontres` CR on CR.id = M.idt
INNER JOIN `coupes` C on C.id = CR.coupe_id
INNER JOIN tournois_name N on N.id = C.id
LEFT JOIN lieux_sites SL on SL.id = CR.lieu
LEFT JOIN lieux_villes SC on SC.id = SL.idv
LEFT JOIN lieux_pays SCO on SCO.code = SC.pays
LEFT JOIN `lieux_pays` T1 ON (T1.code = CR.equipe_domicile)
LEFT JOIN `lieux_pays` T2 ON (T2.code = CR.equipe_exterieur)
WHERE
M.id = '4063838'
&& M.type_tournoi_add = 1
&& (S.statut = 0 || S.statut = 4 || S.statut = 2 || ISNULL(S.statut))
UNION
SELECT
M.*
, M.time_start time_start
, M.time time_end
, M.duration_pause
, M.type_match_add type_match
, M.type_tournoi_add type_tournament
, '' level
, M.qualif
, M.idw winner_id
, P1.id p1_id
, P1.nom p1_name
, P1.prenom p1_first_name
, P1.name_zh p1_name_zh
, P1.birthday p1_birthday
, P1.sexe p1_gender
, P1.nat p1_nat
, P1.photo p1_photo
, P1.taille p1_height
, P1.poids p1_weight
, R1.rank p1_rank
, R1.liveRank p1_rank_live
, P1.pro_depuis p1_turn_pro
, '?' p1_best_rank
, P1.prise p1_forehand
, P1.revers p1_backhand
, M.ts1 p1_seed
, P1B.id p1b_id
, P1B.nom p1b_name
, P1B.prenom p1b_first_name
, P1B.name_zh p1b_name_zh
, P1B.birthday p1b_birthday
, P1B.sexe p1b_gender
, P1B.nat p1b_nat
, P1B.photo p1b_photo
, P1B.taille p1b_height
, P1B.poids p1b_weight
, R1B.rank p1b_rank
, R1B.liveRank p1b_rank_live
, P1B.pro_depuis p1b_turn_pro
, P2.id p2_id
, P2.nom p2_name
, P2.prenom p2_first_name
, P2.name_zh p2_name_zh
, P2.birthday p2_birthday
, P2.sexe p2_gender
, P2.nat p2_nat
, P2.photo p2_photo
, P2.taille p2_height
, P2.poids p2_weight
, R2.rank p2_rank
, R2.liveRank p2_rank_live
, P2.pro_depuis p2_turn_pro
, '?' p2_best_rank
, P2.prise p2_forehand
, P2.revers p2_backhand
, M.ts2 p2_seed
, P2B.id p2b_id
, P2B.nom p2b_name
, P2B.prenom p2b_first_name
, P2B.name_zh p2b_name_zh
, P2B.birthday p2b_birthday
, P2B.sexe p2b_gender
, P2B.nat p2b_nat
, P2B.photo p2b_photo
, P2B.taille p2b_height
, P2B.poids p2b_weight
, R2B.rank p2b_rank
, R2B.liveRank p2b_rank_live
, P2B.pro_depuis p2b_turn_pro
, L.id tournament_id
, 0 tournament_idt
, LR.id rencontre_id
, N.name_fr tournament_name_fr
, N.name_en tournament_name_en
, N.name_zh tournament_name_zh
, N.name_de tournament_name_de
, N.name_es tournament_name_es
, SC.nom tournament_city
, '' tournament_stadium
, '3' tournament_surface
, '' tournament_surface_photo
, '0' tournament_surface_color
, '' tournament_currency
, '' tournament_prize_money
, SCO.nom_fr tournament_country
, '' tournament_logo
, L.time_start tournament_start
, '' tournament_end
, '' tournament_nbPlayer
, '' tournament_genre
, '' tournament_category
, '' tournament_type
, LR.site tournament_site
, L.year tournament_year
, 0 tournament_importance
, '' team1
, '' team2
, 3 importance
, '' tournament_background
, SC.fuseau_horaire
, IF(ISNULL(LS.status) || M.status = 2 || M.status = 3 || M.status = 4, M.status, LS.status) match_status
, LS.serve
, S.time s_time_start
, S.court
, S.date_loc
, S.type s_type
, S.ordre s_order
, CT.nom court_name
, CT.ordre court_order
FROM
tournois_matchs M
JOIN joueurs P1 on P1.id = M.j1
LEFT JOIN `joueurs` P1B on P1B.id = M.j1_bis
JOIN joueurs P2 on P2.id = M.j2
LEFT JOIN `joueurs` P2B on P2B.id = M.j2_bis
LEFT JOIN tennis_rankings R1 on R1.player = P1.id AND R1.id = IF(P1.sexe = 1, 'wta', 'atp')
LEFT JOIN tennis_rankings R1B on R1B.player = P1B.id AND R1B.id = IF(P1B.sexe = 1, 'wta', 'atp')
LEFT JOIN tennis_rankings R2 on R2.player = P2.id AND R2.id = IF(P2.sexe = 1, 'wta', 'atp')
LEFT JOIN tennis_rankings R2B on R2B.player = P2B.id AND R2B.id = IF(P2B.sexe = 1, 'wta', 'atp')
LEFT JOIN `livescores_new`.`matchs` LS ON (LS.tt_match_id = M.id)
LEFT JOIN tournois_programmes S on S.idm = M.id
LEFT JOIN lieux_courts CT on (CT.ids = S.ids && CT.ordre = S.court)
JOIN `leagues_rounds` LR on LR.id = M.league_round
JOIN `leagues` L on L.id = LR.league
JOIN tournois_name N on N.league = L.id
LEFT JOIN lieux_sites SL on SL.id = LR.site
LEFT JOIN lieux_villes SC on SC.id = SL.idv
LEFT JOIN lieux_pays SCO on SCO.code = SC.pays
WHERE
M.id = '4063838'
&& M.type_tournoi_add = 2
&& (S.statut = 0 || S.statut = 4 || S.statut = 2 || ISNULL(S.statut))
LIMIT 1
SELECT M.*
, M.time_start time_start
, M.time time_end
, M.duration_pause
, M.type_match_add type_match
, M.type_tournoi_add type_tournament
, M.niveau level
, M.qualif
, M.idw winner_id
, P1.id p1_id
, P1.nom p1_name
, P1.prenom p1_first_name
, P1.name_zh p1_name_zh
, P1.birthday p1_birthday
, P1.sexe p1_gender
, P1.nat p1_nat
, P1.photo p1_photo
, P1.taille p1_height
, P1.poids p1_weight
, R1.rank p1_rank
, R1.liveRank p1_rank_live
, P1.pro_depuis p1_turn_pro
, '?' p1_best_rank
, P1.prise p1_forehand
, P1.revers p1_backhand
, M.ts1 p1_seed
, P1B.id p1b_id
, P1B.nom p1b_name
, P1B.prenom p1b_first_name
, P1B.name_zh p1b_name_zh
, P1B.birthday p1b_birthday
, P1B.sexe p1b_gender
, P1B.nat p1b_nat
, P1B.photo p1b_photo
, P1B.taille p1b_height
, P1B.poids p1b_weight
, R1B.rank p1b_rank
, R1B.liveRank p1b_rank_live
, P1B.pro_depuis p1b_turn_pro
, P2.id p2_id
, P2.nom p2_name
, P2.prenom p2_first_name
, P2.name_zh p2_name_zh
, P2.birthday p2_birthday
, P2.sexe p2_gender
, P2.nat p2_nat
, P2.photo p2_photo
, P2.taille p2_height
, P2.poids p2_weight
, R2.rank p2_rank
, R2.liveRank p2_rank_live
, P2.pro_depuis p2_turn_pro
, '?' p2_best_rank
, P2.prise p2_forehand
, P2.revers p2_backhand
, M.ts2 p2_seed
, P2B.id p2b_id
, P2B.nom p2b_name
, P2B.prenom p2b_first_name
, P2B.name_zh p2b_name_zh
, P2B.birthday p2b_birthday
, P2B.sexe p2b_gender
, P2B.nat p2b_nat
, P2B.photo p2b_photo
, P2B.taille p2b_height
, P2B.poids p2b_weight
, R2B.rank p2b_rank
, R2B.liveRank p2b_rank_live
, P2B.pro_depuis p2b_turn_pro
, T.id tournament_id
, T.idt tournament_idt
, '?' rencontre_id
, N.name_fr tournament_name_fr
, N.name_en tournament_name_en
, N.name_zh tournament_name_zh
, N.name_de tournament_name_de
, N.name_es tournament_name_es
, T.ville tournament_city
, T.stade tournament_stadium
, T.surface tournament_surface
, T.surface_photo tournament_surface_photo
, T.surface_color tournament_surface_color
, T.monnaie tournament_currency
, T.prix tournament_prize_money
, SCO.nom_fr tournament_country
, T.logo tournament_logo
, T.debut tournament_start
, T.fin tournament_end
, T.nbj tournament_nbPlayer
, T.genre tournament_genre
, T.category tournament_category
, T.type tournament_type
, T.ids tournament_site
, T.year tournament_year
, T.importance tournament_importance
, '' team1
, '' team2
, T.importance
, T.background tournament_background
, SC.fuseau_horaire
, IF(ISNULL(LS.status) || M.status = 2 || M.status = 3 || M.status = 4, M.status, LS.status) match_status
, LS.serve
, S.time s_time_start
, S.court
, S.date_loc
, S.type s_type
, S.ordre s_order
, C.nom court_name
, C.ordre court_order
FROM
tournois_matchs M
INNER JOIN joueurs P1 on P1.id = M.j1
LEFT OUTER JOIN `joueurs` P1B on P1B.id = M.j1_bis
INNER JOIN joueurs P2 on P2.id = M.j2
LEFT OUTER JOIN `joueurs` P2B on P2B.id = M.j2_bis
LEFT JOIN tennis_rankings R1 on R1.player = P1.id AND R1.id = IF(P1.sexe = 1, 'wta', 'atp')
LEFT JOIN tennis_rankings R1B on R1B.player = P1B.id AND R1B.id = IF(P1B.sexe = 1, 'wta', 'atp')
LEFT JOIN tennis_rankings R2 on R2.player = P2.id AND R2.id = IF(P2.sexe = 1, 'wta', 'atp')
LEFT JOIN tennis_rankings R2B on R2B.player = P2B.id AND R2B.id = IF(P2B.sexe = 1, 'wta', 'atp')
INNER JOIN tournois T on T.id = M.idt
INNER JOIN tournois_name N on N.id = T.id && N.cup = 0
LEFT OUTER JOIN lieux_sites SL on T.ids = SL.id
LEFT OUTER JOIN lieux_villes SC on SL.idv = SC.id
LEFT OUTER JOIN lieux_pays SCO on SCO.code = SC.pays
LEFT OUTER JOIN `livescores_new`.`matchs` LS on LS.tt_match_id = M.id
LEFT OUTER JOIN tournois_programmes S on S.idm = M.id
LEFT OUTER JOIN lieux_courts C on C.ids = S.ids && C.ordre = S.court
WHERE
M.id = '4063830'
&& M.type_tournoi_add = 0
&& (S.statut = 0 || S.statut = 4 || S.statut = 2 || ISNULL(S.statut))
UNION
SELECT
M.*
, M.time_start time_start
, M.time time_end
, M.duration_pause
, M.type_match_add type_match
, M.type_tournoi_add type_tournament
, CR.niveau level
, M.qualif
, M.idw winner_id
, P1.id p1_id
, P1.nom p1_name
, P1.prenom p1_first_name
, P1.name_zh p1_name_zh
, P1.birthday p1_birthday
, P1.sexe p1_gender
, P1.nat p1_nat
, P1.photo p1_photo
, P1.taille p1_height
, P1.poids p1_weight
, R1.rank p1_rank
, R1.liveRank p1_rank_live
, P1.pro_depuis p1_turn_pro
, '?' p1_best_rank
, P1.prise p1_forehand
, P1.revers p1_backhand
, M.ts1 p1_seed
, P1B.id p1b_id
, P1B.nom p1b_name
, P1B.prenom p1b_first_name
, P1B.name_zh p1b_name_zh
, P1B.birthday p1b_birthday
, P1B.sexe p1b_gender
, P1B.nat p1b_nat
, P1B.photo p1b_photo
, P1B.taille p1b_height
, P1B.poids p1b_weight
, R1B.rank p1b_rank
, R1B.liveRank p1b_rank_live
, P1B.pro_depuis p1b_turn_pro
, P2.id p2_id
, P2.nom p2_name
, P2.prenom p2_first_name
, P2.name_zh p2_name_zh
, P2.birthday p2_birthday
, P2.sexe p2_gender
, P2.nat p2_nat
, P2.photo p2_photo
, P2.taille p2_height
, P2.poids p2_weight
, R2.rank p2_rank
, R2.liveRank p2_rank_live
, P2.pro_depuis p2_turn_pro
, '?' p2_best_rank
, P2.prise p2_forehand
, P2.revers p2_backhand
, M.ts2 p2_seed
, P2B.id p2b_id
, P2B.nom p2b_name
, P2B.prenom p2b_first_name
, P2B.name_zh p2b_name_zh
, P2B.birthday p2b_birthday
, P2B.sexe p2b_gender
, P2B.nat p2b_nat
, P2B.photo p2b_photo
, P2B.taille p2b_height
, P2B.poids p2b_weight
, R2B.rank p2b_rank
, R2B.liveRank p2b_rank_live
, P2B.pro_depuis p2b_turn_pro
, C.id tournament_id
, C.parent tournament_idt
, CR.id rencontre_id
, N.name_fr tournament_name_fr
, N.name_en tournament_name_en
, N.name_zh tournament_name_zh
, N.name_de tournament_name_de
, N.name_es tournament_name_es
, CONCAT(CR.equipe_domicile, '|', CR.equipe_exterieur) tournament_city
, '' tournament_stadium
, CR.surface tournament_surface
, '' tournament_surface_photo
, '0' tournament_surface_color
, '' tournament_currency
, '' tournament_prize_money
, SCO.nom_fr tournament_country
, '' tournament_logo
, CR.date_d tournament_start
, '' tournament_end
, C.nbj tournament_nbPlayer
, '' tournament_genre
, '' tournament_category
, '' tournament_type
, CR.lieu tournament_site
, '' tournament_year
, 65 tournament_importance
, IF(T1.nom_fr, T1.nom_fr, CR.equipe_domicile) team1
, IF(T2.nom_fr, T1.nom_fr, CR.equipe_exterieur) team2
, 65 importance
, '' tournament_background
, SC.fuseau_horaire
, IF(ISNULL(LS.status) || M.status = 2 || M.status = 3 || M.status = 4, M.status, LS.status) match_status
, LS.serve
, S.time s_time_start
, S.court
, S.date_loc
, S.type s_type
, S.ordre s_order
, CT.nom court_name
, CT.ordre court_order
FROM
tournois_matchs M
INNER JOIN joueurs P1 on P1.id = M.j1
LEFT OUTER JOIN `joueurs` P1B on P1B.id = M.j1_bis
INNER JOIN joueurs P2 on P2.id = M.j2
LEFT OUTER JOIN `joueurs` P2B on P2B.id = M.j2_bis
LEFT JOIN tennis_rankings R1 on R1.player = P1.id AND R1.id = IF(P1.sexe = 1, 'wta', 'atp')
LEFT JOIN tennis_rankings R1B on R1B.player = P1B.id AND R1B.id = IF(P1B.sexe = 1, 'wta', 'atp')
LEFT JOIN tennis_rankings R2 on R2.player = P2.id AND R2.id = IF(P2.sexe = 1, 'wta', 'atp')
LEFT JOIN tennis_rankings R2B on R2B.player = P2B.id AND R2B.id = IF(P2B.sexe = 1, 'wta', 'atp')
LEFT OUTER JOIN `livescores_new`.`matchs` LS ON (LS.tt_match_id = M.id)
LEFT OUTER JOIN tournois_programmes S on S.idm = M.id
LEFT OUTER JOIN lieux_courts CT on (CT.ids = S.ids && CT.ordre = S.court)
INNER JOIN `coupes_rencontres` CR on CR.id = M.idt
INNER JOIN `coupes` C on C.id = CR.coupe_id
INNER JOIN tournois_name N on N.id = C.id
LEFT JOIN lieux_sites SL on SL.id = CR.lieu
LEFT JOIN lieux_villes SC on SC.id = SL.idv
LEFT JOIN lieux_pays SCO on SCO.code = SC.pays
LEFT JOIN `lieux_pays` T1 ON (T1.code = CR.equipe_domicile)
LEFT JOIN `lieux_pays` T2 ON (T2.code = CR.equipe_exterieur)
WHERE
M.id = '4063830'
&& M.type_tournoi_add = 1
&& (S.statut = 0 || S.statut = 4 || S.statut = 2 || ISNULL(S.statut))
UNION
SELECT
M.*
, M.time_start time_start
, M.time time_end
, M.duration_pause
, M.type_match_add type_match
, M.type_tournoi_add type_tournament
, '' level
, M.qualif
, M.idw winner_id
, P1.id p1_id
, P1.nom p1_name
, P1.prenom p1_first_name
, P1.name_zh p1_name_zh
, P1.birthday p1_birthday
, P1.sexe p1_gender
, P1.nat p1_nat
, P1.photo p1_photo
, P1.taille p1_height
, P1.poids p1_weight
, R1.rank p1_rank
, R1.liveRank p1_rank_live
, P1.pro_depuis p1_turn_pro
, '?' p1_best_rank
, P1.prise p1_forehand
, P1.revers p1_backhand
, M.ts1 p1_seed
, P1B.id p1b_id
, P1B.nom p1b_name
, P1B.prenom p1b_first_name
, P1B.name_zh p1b_name_zh
, P1B.birthday p1b_birthday
, P1B.sexe p1b_gender
, P1B.nat p1b_nat
, P1B.photo p1b_photo
, P1B.taille p1b_height
, P1B.poids p1b_weight
, R1B.rank p1b_rank
, R1B.liveRank p1b_rank_live
, P1B.pro_depuis p1b_turn_pro
, P2.id p2_id
, P2.nom p2_name
, P2.prenom p2_first_name
, P2.name_zh p2_name_zh
, P2.birthday p2_birthday
, P2.sexe p2_gender
, P2.nat p2_nat
, P2.photo p2_photo
, P2.taille p2_height
, P2.poids p2_weight
, R2.rank p2_rank
, R2.liveRank p2_rank_live
, P2.pro_depuis p2_turn_pro
, '?' p2_best_rank
, P2.prise p2_forehand
, P2.revers p2_backhand
, M.ts2 p2_seed
, P2B.id p2b_id
, P2B.nom p2b_name
, P2B.prenom p2b_first_name
, P2B.name_zh p2b_name_zh
, P2B.birthday p2b_birthday
, P2B.sexe p2b_gender
, P2B.nat p2b_nat
, P2B.photo p2b_photo
, P2B.taille p2b_height
, P2B.poids p2b_weight
, R2B.rank p2b_rank
, R2B.liveRank p2b_rank_live
, P2B.pro_depuis p2b_turn_pro
, L.id tournament_id
, 0 tournament_idt
, LR.id rencontre_id
, N.name_fr tournament_name_fr
, N.name_en tournament_name_en
, N.name_zh tournament_name_zh
, N.name_de tournament_name_de
, N.name_es tournament_name_es
, SC.nom tournament_city
, '' tournament_stadium
, '3' tournament_surface
, '' tournament_surface_photo
, '0' tournament_surface_color
, '' tournament_currency
, '' tournament_prize_money
, SCO.nom_fr tournament_country
, '' tournament_logo
, L.time_start tournament_start
, '' tournament_end
, '' tournament_nbPlayer
, '' tournament_genre
, '' tournament_category
, '' tournament_type
, LR.site tournament_site
, L.year tournament_year
, 0 tournament_importance
, '' team1
, '' team2
, 3 importance
, '' tournament_background
, SC.fuseau_horaire
, IF(ISNULL(LS.status) || M.status = 2 || M.status = 3 || M.status = 4, M.status, LS.status) match_status
, LS.serve
, S.time s_time_start
, S.court
, S.date_loc
, S.type s_type
, S.ordre s_order
, CT.nom court_name
, CT.ordre court_order
FROM
tournois_matchs M
JOIN joueurs P1 on P1.id = M.j1
LEFT JOIN `joueurs` P1B on P1B.id = M.j1_bis
JOIN joueurs P2 on P2.id = M.j2
LEFT JOIN `joueurs` P2B on P2B.id = M.j2_bis
LEFT JOIN tennis_rankings R1 on R1.player = P1.id AND R1.id = IF(P1.sexe = 1, 'wta', 'atp')
LEFT JOIN tennis_rankings R1B on R1B.player = P1B.id AND R1B.id = IF(P1B.sexe = 1, 'wta', 'atp')
LEFT JOIN tennis_rankings R2 on R2.player = P2.id AND R2.id = IF(P2.sexe = 1, 'wta', 'atp')
LEFT JOIN tennis_rankings R2B on R2B.player = P2B.id AND R2B.id = IF(P2B.sexe = 1, 'wta', 'atp')
LEFT JOIN `livescores_new`.`matchs` LS ON (LS.tt_match_id = M.id)
LEFT JOIN tournois_programmes S on S.idm = M.id
LEFT JOIN lieux_courts CT on (CT.ids = S.ids && CT.ordre = S.court)
JOIN `leagues_rounds` LR on LR.id = M.league_round
JOIN `leagues` L on L.id = LR.league
JOIN tournois_name N on N.league = L.id
LEFT JOIN lieux_sites SL on SL.id = LR.site
LEFT JOIN lieux_villes SC on SC.id = SL.idv
LEFT JOIN lieux_pays SCO on SCO.code = SC.pays
WHERE
M.id = '4063830'
&& M.type_tournoi_add = 2
&& (S.statut = 0 || S.statut = 4 || S.statut = 2 || ISNULL(S.statut))
LIMIT 1
SELECT M.*
, M.time_start time_start
, M.time time_end
, M.duration_pause
, M.type_match_add type_match
, M.type_tournoi_add type_tournament
, M.niveau level
, M.qualif
, M.idw winner_id
, P1.id p1_id
, P1.nom p1_name
, P1.prenom p1_first_name
, P1.name_zh p1_name_zh
, P1.birthday p1_birthday
, P1.sexe p1_gender
, P1.nat p1_nat
, P1.photo p1_photo
, P1.taille p1_height
, P1.poids p1_weight
, R1.rank p1_rank
, R1.liveRank p1_rank_live
, P1.pro_depuis p1_turn_pro
, '?' p1_best_rank
, P1.prise p1_forehand
, P1.revers p1_backhand
, M.ts1 p1_seed
, P1B.id p1b_id
, P1B.nom p1b_name
, P1B.prenom p1b_first_name
, P1B.name_zh p1b_name_zh
, P1B.birthday p1b_birthday
, P1B.sexe p1b_gender
, P1B.nat p1b_nat
, P1B.photo p1b_photo
, P1B.taille p1b_height
, P1B.poids p1b_weight
, R1B.rank p1b_rank
, R1B.liveRank p1b_rank_live
, P1B.pro_depuis p1b_turn_pro
, P2.id p2_id
, P2.nom p2_name
, P2.prenom p2_first_name
, P2.name_zh p2_name_zh
, P2.birthday p2_birthday
, P2.sexe p2_gender
, P2.nat p2_nat
, P2.photo p2_photo
, P2.taille p2_height
, P2.poids p2_weight
, R2.rank p2_rank
, R2.liveRank p2_rank_live
, P2.pro_depuis p2_turn_pro
, '?' p2_best_rank
, P2.prise p2_forehand
, P2.revers p2_backhand
, M.ts2 p2_seed
, P2B.id p2b_id
, P2B.nom p2b_name
, P2B.prenom p2b_first_name
, P2B.name_zh p2b_name_zh
, P2B.birthday p2b_birthday
, P2B.sexe p2b_gender
, P2B.nat p2b_nat
, P2B.photo p2b_photo
, P2B.taille p2b_height
, P2B.poids p2b_weight
, R2B.rank p2b_rank
, R2B.liveRank p2b_rank_live
, P2B.pro_depuis p2b_turn_pro
, T.id tournament_id
, T.idt tournament_idt
, '?' rencontre_id
, N.name_fr tournament_name_fr
, N.name_en tournament_name_en
, N.name_zh tournament_name_zh
, N.name_de tournament_name_de
, N.name_es tournament_name_es
, T.ville tournament_city
, T.stade tournament_stadium
, T.surface tournament_surface
, T.surface_photo tournament_surface_photo
, T.surface_color tournament_surface_color
, T.monnaie tournament_currency
, T.prix tournament_prize_money
, SCO.nom_fr tournament_country
, T.logo tournament_logo
, T.debut tournament_start
, T.fin tournament_end
, T.nbj tournament_nbPlayer
, T.genre tournament_genre
, T.category tournament_category
, T.type tournament_type
, T.ids tournament_site
, T.year tournament_year
, T.importance tournament_importance
, '' team1
, '' team2
, T.importance
, T.background tournament_background
, SC.fuseau_horaire
, IF(ISNULL(LS.status) || M.status = 2 || M.status = 3 || M.status = 4, M.status, LS.status) match_status
, LS.serve
, S.time s_time_start
, S.court
, S.date_loc
, S.type s_type
, S.ordre s_order
, C.nom court_name
, C.ordre court_order
FROM
tournois_matchs M
INNER JOIN joueurs P1 on P1.id = M.j1
LEFT OUTER JOIN `joueurs` P1B on P1B.id = M.j1_bis
INNER JOIN joueurs P2 on P2.id = M.j2
LEFT OUTER JOIN `joueurs` P2B on P2B.id = M.j2_bis
LEFT JOIN tennis_rankings R1 on R1.player = P1.id AND R1.id = IF(P1.sexe = 1, 'wta', 'atp')
LEFT JOIN tennis_rankings R1B on R1B.player = P1B.id AND R1B.id = IF(P1B.sexe = 1, 'wta', 'atp')
LEFT JOIN tennis_rankings R2 on R2.player = P2.id AND R2.id = IF(P2.sexe = 1, 'wta', 'atp')
LEFT JOIN tennis_rankings R2B on R2B.player = P2B.id AND R2B.id = IF(P2B.sexe = 1, 'wta', 'atp')
INNER JOIN tournois T on T.id = M.idt
INNER JOIN tournois_name N on N.id = T.id && N.cup = 0
LEFT OUTER JOIN lieux_sites SL on T.ids = SL.id
LEFT OUTER JOIN lieux_villes SC on SL.idv = SC.id
LEFT OUTER JOIN lieux_pays SCO on SCO.code = SC.pays
LEFT OUTER JOIN `livescores_new`.`matchs` LS on LS.tt_match_id = M.id
LEFT OUTER JOIN tournois_programmes S on S.idm = M.id
LEFT OUTER JOIN lieux_courts C on C.ids = S.ids && C.ordre = S.court
WHERE
M.id = '4063815'
&& M.type_tournoi_add = 0
&& (S.statut = 0 || S.statut = 4 || S.statut = 2 || ISNULL(S.statut))
UNION
SELECT
M.*
, M.time_start time_start
, M.time time_end
, M.duration_pause
, M.type_match_add type_match
, M.type_tournoi_add type_tournament
, CR.niveau level
, M.qualif
, M.idw winner_id
, P1.id p1_id
, P1.nom p1_name
, P1.prenom p1_first_name
, P1.name_zh p1_name_zh
, P1.birthday p1_birthday
, P1.sexe p1_gender
, P1.nat p1_nat
, P1.photo p1_photo
, P1.taille p1_height
, P1.poids p1_weight
, R1.rank p1_rank
, R1.liveRank p1_rank_live
, P1.pro_depuis p1_turn_pro
, '?' p1_best_rank
, P1.prise p1_forehand
, P1.revers p1_backhand
, M.ts1 p1_seed
, P1B.id p1b_id
, P1B.nom p1b_name
, P1B.prenom p1b_first_name
, P1B.name_zh p1b_name_zh
, P1B.birthday p1b_birthday
, P1B.sexe p1b_gender
, P1B.nat p1b_nat
, P1B.photo p1b_photo
, P1B.taille p1b_height
, P1B.poids p1b_weight
, R1B.rank p1b_rank
, R1B.liveRank p1b_rank_live
, P1B.pro_depuis p1b_turn_pro
, P2.id p2_id
, P2.nom p2_name
, P2.prenom p2_first_name
, P2.name_zh p2_name_zh
, P2.birthday p2_birthday
, P2.sexe p2_gender
, P2.nat p2_nat
, P2.photo p2_photo
, P2.taille p2_height
, P2.poids p2_weight
, R2.rank p2_rank
, R2.liveRank p2_rank_live
, P2.pro_depuis p2_turn_pro
, '?' p2_best_rank
, P2.prise p2_forehand
, P2.revers p2_backhand
, M.ts2 p2_seed
, P2B.id p2b_id
, P2B.nom p2b_name
, P2B.prenom p2b_first_name
, P2B.name_zh p2b_name_zh
, P2B.birthday p2b_birthday
, P2B.sexe p2b_gender
, P2B.nat p2b_nat
, P2B.photo p2b_photo
, P2B.taille p2b_height
, P2B.poids p2b_weight
, R2B.rank p2b_rank
, R2B.liveRank p2b_rank_live
, P2B.pro_depuis p2b_turn_pro
, C.id tournament_id
, C.parent tournament_idt
, CR.id rencontre_id
, N.name_fr tournament_name_fr
, N.name_en tournament_name_en
, N.name_zh tournament_name_zh
, N.name_de tournament_name_de
, N.name_es tournament_name_es
, CONCAT(CR.equipe_domicile, '|', CR.equipe_exterieur) tournament_city
, '' tournament_stadium
, CR.surface tournament_surface
, '' tournament_surface_photo
, '0' tournament_surface_color
, '' tournament_currency
, '' tournament_prize_money
, SCO.nom_fr tournament_country
, '' tournament_logo
, CR.date_d tournament_start
, '' tournament_end
, C.nbj tournament_nbPlayer
, '' tournament_genre
, '' tournament_category
, '' tournament_type
, CR.lieu tournament_site
, '' tournament_year
, 65 tournament_importance
, IF(T1.nom_fr, T1.nom_fr, CR.equipe_domicile) team1
, IF(T2.nom_fr, T1.nom_fr, CR.equipe_exterieur) team2
, 65 importance
, '' tournament_background
, SC.fuseau_horaire
, IF(ISNULL(LS.status) || M.status = 2 || M.status = 3 || M.status = 4, M.status, LS.status) match_status
, LS.serve
, S.time s_time_start
, S.court
, S.date_loc
, S.type s_type
, S.ordre s_order
, CT.nom court_name
, CT.ordre court_order
FROM
tournois_matchs M
INNER JOIN joueurs P1 on P1.id = M.j1
LEFT OUTER JOIN `joueurs` P1B on P1B.id = M.j1_bis
INNER JOIN joueurs P2 on P2.id = M.j2
LEFT OUTER JOIN `joueurs` P2B on P2B.id = M.j2_bis
LEFT JOIN tennis_rankings R1 on R1.player = P1.id AND R1.id = IF(P1.sexe = 1, 'wta', 'atp')
LEFT JOIN tennis_rankings R1B on R1B.player = P1B.id AND R1B.id = IF(P1B.sexe = 1, 'wta', 'atp')
LEFT JOIN tennis_rankings R2 on R2.player = P2.id AND R2.id = IF(P2.sexe = 1, 'wta', 'atp')
LEFT JOIN tennis_rankings R2B on R2B.player = P2B.id AND R2B.id = IF(P2B.sexe = 1, 'wta', 'atp')
LEFT OUTER JOIN `livescores_new`.`matchs` LS ON (LS.tt_match_id = M.id)
LEFT OUTER JOIN tournois_programmes S on S.idm = M.id
LEFT OUTER JOIN lieux_courts CT on (CT.ids = S.ids && CT.ordre = S.court)
INNER JOIN `coupes_rencontres` CR on CR.id = M.idt
INNER JOIN `coupes` C on C.id = CR.coupe_id
INNER JOIN tournois_name N on N.id = C.id
LEFT JOIN lieux_sites SL on SL.id = CR.lieu
LEFT JOIN lieux_villes SC on SC.id = SL.idv
LEFT JOIN lieux_pays SCO on SCO.code = SC.pays
LEFT JOIN `lieux_pays` T1 ON (T1.code = CR.equipe_domicile)
LEFT JOIN `lieux_pays` T2 ON (T2.code = CR.equipe_exterieur)
WHERE
M.id = '4063815'
&& M.type_tournoi_add = 1
&& (S.statut = 0 || S.statut = 4 || S.statut = 2 || ISNULL(S.statut))
UNION
SELECT
M.*
, M.time_start time_start
, M.time time_end
, M.duration_pause
, M.type_match_add type_match
, M.type_tournoi_add type_tournament
, '' level
, M.qualif
, M.idw winner_id
, P1.id p1_id
, P1.nom p1_name
, P1.prenom p1_first_name
, P1.name_zh p1_name_zh
, P1.birthday p1_birthday
, P1.sexe p1_gender
, P1.nat p1_nat
, P1.photo p1_photo
, P1.taille p1_height
, P1.poids p1_weight
, R1.rank p1_rank
, R1.liveRank p1_rank_live
, P1.pro_depuis p1_turn_pro
, '?' p1_best_rank
, P1.prise p1_forehand
, P1.revers p1_backhand
, M.ts1 p1_seed
, P1B.id p1b_id
, P1B.nom p1b_name
, P1B.prenom p1b_first_name
, P1B.name_zh p1b_name_zh
, P1B.birthday p1b_birthday
, P1B.sexe p1b_gender
, P1B.nat p1b_nat
, P1B.photo p1b_photo
, P1B.taille p1b_height
, P1B.poids p1b_weight
, R1B.rank p1b_rank
, R1B.liveRank p1b_rank_live
, P1B.pro_depuis p1b_turn_pro
, P2.id p2_id
, P2.nom p2_name
, P2.prenom p2_first_name
, P2.name_zh p2_name_zh
, P2.birthday p2_birthday
, P2.sexe p2_gender
, P2.nat p2_nat
, P2.photo p2_photo
, P2.taille p2_height
, P2.poids p2_weight
, R2.rank p2_rank
, R2.liveRank p2_rank_live
, P2.pro_depuis p2_turn_pro
, '?' p2_best_rank
, P2.prise p2_forehand
, P2.revers p2_backhand
, M.ts2 p2_seed
, P2B.id p2b_id
, P2B.nom p2b_name
, P2B.prenom p2b_first_name
, P2B.name_zh p2b_name_zh
, P2B.birthday p2b_birthday
, P2B.sexe p2b_gender
, P2B.nat p2b_nat
, P2B.photo p2b_photo
, P2B.taille p2b_height
, P2B.poids p2b_weight
, R2B.rank p2b_rank
, R2B.liveRank p2b_rank_live
, P2B.pro_depuis p2b_turn_pro
, L.id tournament_id
, 0 tournament_idt
, LR.id rencontre_id
, N.name_fr tournament_name_fr
, N.name_en tournament_name_en
, N.name_zh tournament_name_zh
, N.name_de tournament_name_de
, N.name_es tournament_name_es
, SC.nom tournament_city
, '' tournament_stadium
, '3' tournament_surface
, '' tournament_surface_photo
, '0' tournament_surface_color
, '' tournament_currency
, '' tournament_prize_money
, SCO.nom_fr tournament_country
, '' tournament_logo
, L.time_start tournament_start
, '' tournament_end
, '' tournament_nbPlayer
, '' tournament_genre
, '' tournament_category
, '' tournament_type
, LR.site tournament_site
, L.year tournament_year
, 0 tournament_importance
, '' team1
, '' team2
, 3 importance
, '' tournament_background
, SC.fuseau_horaire
, IF(ISNULL(LS.status) || M.status = 2 || M.status = 3 || M.status = 4, M.status, LS.status) match_status
, LS.serve
, S.time s_time_start
, S.court
, S.date_loc
, S.type s_type
, S.ordre s_order
, CT.nom court_name
, CT.ordre court_order
FROM
tournois_matchs M
JOIN joueurs P1 on P1.id = M.j1
LEFT JOIN `joueurs` P1B on P1B.id = M.j1_bis
JOIN joueurs P2 on P2.id = M.j2
LEFT JOIN `joueurs` P2B on P2B.id = M.j2_bis
LEFT JOIN tennis_rankings R1 on R1.player = P1.id AND R1.id = IF(P1.sexe = 1, 'wta', 'atp')
LEFT JOIN tennis_rankings R1B on R1B.player = P1B.id AND R1B.id = IF(P1B.sexe = 1, 'wta', 'atp')
LEFT JOIN tennis_rankings R2 on R2.player = P2.id AND R2.id = IF(P2.sexe = 1, 'wta', 'atp')
LEFT JOIN tennis_rankings R2B on R2B.player = P2B.id AND R2B.id = IF(P2B.sexe = 1, 'wta', 'atp')
LEFT JOIN `livescores_new`.`matchs` LS ON (LS.tt_match_id = M.id)
LEFT JOIN tournois_programmes S on S.idm = M.id
LEFT JOIN lieux_courts CT on (CT.ids = S.ids && CT.ordre = S.court)
JOIN `leagues_rounds` LR on LR.id = M.league_round
JOIN `leagues` L on L.id = LR.league
JOIN tournois_name N on N.league = L.id
LEFT JOIN lieux_sites SL on SL.id = LR.site
LEFT JOIN lieux_villes SC on SC.id = SL.idv
LEFT JOIN lieux_pays SCO on SCO.code = SC.pays
WHERE
M.id = '4063815'
&& M.type_tournoi_add = 2
&& (S.statut = 0 || S.statut = 4 || S.statut = 2 || ISNULL(S.statut))
LIMIT 1
SELECT M.*
, M.time_start time_start
, M.time time_end
, M.duration_pause
, M.type_match_add type_match
, M.type_tournoi_add type_tournament
, M.niveau level
, M.qualif
, M.idw winner_id
, P1.id p1_id
, P1.nom p1_name
, P1.prenom p1_first_name
, P1.name_zh p1_name_zh
, P1.birthday p1_birthday
, P1.sexe p1_gender
, P1.nat p1_nat
, P1.photo p1_photo
, P1.taille p1_height
, P1.poids p1_weight
, R1.rank p1_rank
, R1.liveRank p1_rank_live
, P1.pro_depuis p1_turn_pro
, '?' p1_best_rank
, P1.prise p1_forehand
, P1.revers p1_backhand
, M.ts1 p1_seed
, P1B.id p1b_id
, P1B.nom p1b_name
, P1B.prenom p1b_first_name
, P1B.name_zh p1b_name_zh
, P1B.birthday p1b_birthday
, P1B.sexe p1b_gender
, P1B.nat p1b_nat
, P1B.photo p1b_photo
, P1B.taille p1b_height
, P1B.poids p1b_weight
, R1B.rank p1b_rank
, R1B.liveRank p1b_rank_live
, P1B.pro_depuis p1b_turn_pro
, P2.id p2_id
, P2.nom p2_name
, P2.prenom p2_first_name
, P2.name_zh p2_name_zh
, P2.birthday p2_birthday
, P2.sexe p2_gender
, P2.nat p2_nat
, P2.photo p2_photo
, P2.taille p2_height
, P2.poids p2_weight
, R2.rank p2_rank
, R2.liveRank p2_rank_live
, P2.pro_depuis p2_turn_pro
, '?' p2_best_rank
, P2.prise p2_forehand
, P2.revers p2_backhand
, M.ts2 p2_seed
, P2B.id p2b_id
, P2B.nom p2b_name
, P2B.prenom p2b_first_name
, P2B.name_zh p2b_name_zh
, P2B.birthday p2b_birthday
, P2B.sexe p2b_gender
, P2B.nat p2b_nat
, P2B.photo p2b_photo
, P2B.taille p2b_height
, P2B.poids p2b_weight
, R2B.rank p2b_rank
, R2B.liveRank p2b_rank_live
, P2B.pro_depuis p2b_turn_pro
, T.id tournament_id
, T.idt tournament_idt
, '?' rencontre_id
, N.name_fr tournament_name_fr
, N.name_en tournament_name_en
, N.name_zh tournament_name_zh
, N.name_de tournament_name_de
, N.name_es tournament_name_es
, T.ville tournament_city
, T.stade tournament_stadium
, T.surface tournament_surface
, T.surface_photo tournament_surface_photo
, T.surface_color tournament_surface_color
, T.monnaie tournament_currency
, T.prix tournament_prize_money
, SCO.nom_fr tournament_country
, T.logo tournament_logo
, T.debut tournament_start
, T.fin tournament_end
, T.nbj tournament_nbPlayer
, T.genre tournament_genre
, T.category tournament_category
, T.type tournament_type
, T.ids tournament_site
, T.year tournament_year
, T.importance tournament_importance
, '' team1
, '' team2
, T.importance
, T.background tournament_background
, SC.fuseau_horaire
, IF(ISNULL(LS.status) || M.status = 2 || M.status = 3 || M.status = 4, M.status, LS.status) match_status
, LS.serve
, S.time s_time_start
, S.court
, S.date_loc
, S.type s_type
, S.ordre s_order
, C.nom court_name
, C.ordre court_order
FROM
tournois_matchs M
INNER JOIN joueurs P1 on P1.id = M.j1
LEFT OUTER JOIN `joueurs` P1B on P1B.id = M.j1_bis
INNER JOIN joueurs P2 on P2.id = M.j2
LEFT OUTER JOIN `joueurs` P2B on P2B.id = M.j2_bis
LEFT JOIN tennis_rankings R1 on R1.player = P1.id AND R1.id = IF(P1.sexe = 1, 'wta', 'atp')
LEFT JOIN tennis_rankings R1B on R1B.player = P1B.id AND R1B.id = IF(P1B.sexe = 1, 'wta', 'atp')
LEFT JOIN tennis_rankings R2 on R2.player = P2.id AND R2.id = IF(P2.sexe = 1, 'wta', 'atp')
LEFT JOIN tennis_rankings R2B on R2B.player = P2B.id AND R2B.id = IF(P2B.sexe = 1, 'wta', 'atp')
INNER JOIN tournois T on T.id = M.idt
INNER JOIN tournois_name N on N.id = T.id && N.cup = 0
LEFT OUTER JOIN lieux_sites SL on T.ids = SL.id
LEFT OUTER JOIN lieux_villes SC on SL.idv = SC.id
LEFT OUTER JOIN lieux_pays SCO on SCO.code = SC.pays
LEFT OUTER JOIN `livescores_new`.`matchs` LS on LS.tt_match_id = M.id
LEFT OUTER JOIN tournois_programmes S on S.idm = M.id
LEFT OUTER JOIN lieux_courts C on C.ids = S.ids && C.ordre = S.court
WHERE
M.id = '4063832'
&& M.type_tournoi_add = 0
&& (S.statut = 0 || S.statut = 4 || S.statut = 2 || ISNULL(S.statut))
UNION
SELECT
M.*
, M.time_start time_start
, M.time time_end
, M.duration_pause
, M.type_match_add type_match
, M.type_tournoi_add type_tournament
, CR.niveau level
, M.qualif
, M.idw winner_id
, P1.id p1_id
, P1.nom p1_name
, P1.prenom p1_first_name
, P1.name_zh p1_name_zh
, P1.birthday p1_birthday
, P1.sexe p1_gender
, P1.nat p1_nat
, P1.photo p1_photo
, P1.taille p1_height
, P1.poids p1_weight
, R1.rank p1_rank
, R1.liveRank p1_rank_live
, P1.pro_depuis p1_turn_pro
, '?' p1_best_rank
, P1.prise p1_forehand
, P1.revers p1_backhand
, M.ts1 p1_seed
, P1B.id p1b_id
, P1B.nom p1b_name
, P1B.prenom p1b_first_name
, P1B.name_zh p1b_name_zh
, P1B.birthday p1b_birthday
, P1B.sexe p1b_gender
, P1B.nat p1b_nat
, P1B.photo p1b_photo
, P1B.taille p1b_height
, P1B.poids p1b_weight
, R1B.rank p1b_rank
, R1B.liveRank p1b_rank_live
, P1B.pro_depuis p1b_turn_pro
, P2.id p2_id
, P2.nom p2_name
, P2.prenom p2_first_name
, P2.name_zh p2_name_zh
, P2.birthday p2_birthday
, P2.sexe p2_gender
, P2.nat p2_nat
, P2.photo p2_photo
, P2.taille p2_height
, P2.poids p2_weight
, R2.rank p2_rank
, R2.liveRank p2_rank_live
, P2.pro_depuis p2_turn_pro
, '?' p2_best_rank
, P2.prise p2_forehand
, P2.revers p2_backhand
, M.ts2 p2_seed
, P2B.id p2b_id
, P2B.nom p2b_name
, P2B.prenom p2b_first_name
, P2B.name_zh p2b_name_zh
, P2B.birthday p2b_birthday
, P2B.sexe p2b_gender
, P2B.nat p2b_nat
, P2B.photo p2b_photo
, P2B.taille p2b_height
, P2B.poids p2b_weight
, R2B.rank p2b_rank
, R2B.liveRank p2b_rank_live
, P2B.pro_depuis p2b_turn_pro
, C.id tournament_id
, C.parent tournament_idt
, CR.id rencontre_id
, N.name_fr tournament_name_fr
, N.name_en tournament_name_en
, N.name_zh tournament_name_zh
, N.name_de tournament_name_de
, N.name_es tournament_name_es
, CONCAT(CR.equipe_domicile, '|', CR.equipe_exterieur) tournament_city
, '' tournament_stadium
, CR.surface tournament_surface
, '' tournament_surface_photo
, '0' tournament_surface_color
, '' tournament_currency
, '' tournament_prize_money
, SCO.nom_fr tournament_country
, '' tournament_logo
, CR.date_d tournament_start
, '' tournament_end
, C.nbj tournament_nbPlayer
, '' tournament_genre
, '' tournament_category
, '' tournament_type
, CR.lieu tournament_site
, '' tournament_year
, 65 tournament_importance
, IF(T1.nom_fr, T1.nom_fr, CR.equipe_domicile) team1
, IF(T2.nom_fr, T1.nom_fr, CR.equipe_exterieur) team2
, 65 importance
, '' tournament_background
, SC.fuseau_horaire
, IF(ISNULL(LS.status) || M.status = 2 || M.status = 3 || M.status = 4, M.status, LS.status) match_status
, LS.serve
, S.time s_time_start
, S.court
, S.date_loc
, S.type s_type
, S.ordre s_order
, CT.nom court_name
, CT.ordre court_order
FROM
tournois_matchs M
INNER JOIN joueurs P1 on P1.id = M.j1
LEFT OUTER JOIN `joueurs` P1B on P1B.id = M.j1_bis
INNER JOIN joueurs P2 on P2.id = M.j2
LEFT OUTER JOIN `joueurs` P2B on P2B.id = M.j2_bis
LEFT JOIN tennis_rankings R1 on R1.player = P1.id AND R1.id = IF(P1.sexe = 1, 'wta', 'atp')
LEFT JOIN tennis_rankings R1B on R1B.player = P1B.id AND R1B.id = IF(P1B.sexe = 1, 'wta', 'atp')
LEFT JOIN tennis_rankings R2 on R2.player = P2.id AND R2.id = IF(P2.sexe = 1, 'wta', 'atp')
LEFT JOIN tennis_rankings R2B on R2B.player = P2B.id AND R2B.id = IF(P2B.sexe = 1, 'wta', 'atp')
LEFT OUTER JOIN `livescores_new`.`matchs` LS ON (LS.tt_match_id = M.id)
LEFT OUTER JOIN tournois_programmes S on S.idm = M.id
LEFT OUTER JOIN lieux_courts CT on (CT.ids = S.ids && CT.ordre = S.court)
INNER JOIN `coupes_rencontres` CR on CR.id = M.idt
INNER JOIN `coupes` C on C.id = CR.coupe_id
INNER JOIN tournois_name N on N.id = C.id
LEFT JOIN lieux_sites SL on SL.id = CR.lieu
LEFT JOIN lieux_villes SC on SC.id = SL.idv
LEFT JOIN lieux_pays SCO on SCO.code = SC.pays
LEFT JOIN `lieux_pays` T1 ON (T1.code = CR.equipe_domicile)
LEFT JOIN `lieux_pays` T2 ON (T2.code = CR.equipe_exterieur)
WHERE
M.id = '4063832'
&& M.type_tournoi_add = 1
&& (S.statut = 0 || S.statut = 4 || S.statut = 2 || ISNULL(S.statut))
UNION
SELECT
M.*
, M.time_start time_start
, M.time time_end
, M.duration_pause
, M.type_match_add type_match
, M.type_tournoi_add type_tournament
, '' level
, M.qualif
, M.idw winner_id
, P1.id p1_id
, P1.nom p1_name
, P1.prenom p1_first_name
, P1.name_zh p1_name_zh
, P1.birthday p1_birthday
, P1.sexe p1_gender
, P1.nat p1_nat
, P1.photo p1_photo
, P1.taille p1_height
, P1.poids p1_weight
, R1.rank p1_rank
, R1.liveRank p1_rank_live
, P1.pro_depuis p1_turn_pro
, '?' p1_best_rank
, P1.prise p1_forehand
, P1.revers p1_backhand
, M.ts1 p1_seed
, P1B.id p1b_id
, P1B.nom p1b_name
, P1B.prenom p1b_first_name
, P1B.name_zh p1b_name_zh
, P1B.birthday p1b_birthday
, P1B.sexe p1b_gender
, P1B.nat p1b_nat
, P1B.photo p1b_photo
, P1B.taille p1b_height
, P1B.poids p1b_weight
, R1B.rank p1b_rank
, R1B.liveRank p1b_rank_live
, P1B.pro_depuis p1b_turn_pro
, P2.id p2_id
, P2.nom p2_name
, P2.prenom p2_first_name
, P2.name_zh p2_name_zh
, P2.birthday p2_birthday
, P2.sexe p2_gender
, P2.nat p2_nat
, P2.photo p2_photo
, P2.taille p2_height
, P2.poids p2_weight
, R2.rank p2_rank
, R2.liveRank p2_rank_live
, P2.pro_depuis p2_turn_pro
, '?' p2_best_rank
, P2.prise p2_forehand
, P2.revers p2_backhand
, M.ts2 p2_seed
, P2B.id p2b_id
, P2B.nom p2b_name
, P2B.prenom p2b_first_name
, P2B.name_zh p2b_name_zh
, P2B.birthday p2b_birthday
, P2B.sexe p2b_gender
, P2B.nat p2b_nat
, P2B.photo p2b_photo
, P2B.taille p2b_height
, P2B.poids p2b_weight
, R2B.rank p2b_rank
, R2B.liveRank p2b_rank_live
, P2B.pro_depuis p2b_turn_pro
, L.id tournament_id
, 0 tournament_idt
, LR.id rencontre_id
, N.name_fr tournament_name_fr
, N.name_en tournament_name_en
, N.name_zh tournament_name_zh
, N.name_de tournament_name_de
, N.name_es tournament_name_es
, SC.nom tournament_city
, '' tournament_stadium
, '3' tournament_surface
, '' tournament_surface_photo
, '0' tournament_surface_color
, '' tournament_currency
, '' tournament_prize_money
, SCO.nom_fr tournament_country
, '' tournament_logo
, L.time_start tournament_start
, '' tournament_end
, '' tournament_nbPlayer
, '' tournament_genre
, '' tournament_category
, '' tournament_type
, LR.site tournament_site
, L.year tournament_year
, 0 tournament_importance
, '' team1
, '' team2
, 3 importance
, '' tournament_background
, SC.fuseau_horaire
, IF(ISNULL(LS.status) || M.status = 2 || M.status = 3 || M.status = 4, M.status, LS.status) match_status
, LS.serve
, S.time s_time_start
, S.court
, S.date_loc
, S.type s_type
, S.ordre s_order
, CT.nom court_name
, CT.ordre court_order
FROM
tournois_matchs M
JOIN joueurs P1 on P1.id = M.j1
LEFT JOIN `joueurs` P1B on P1B.id = M.j1_bis
JOIN joueurs P2 on P2.id = M.j2
LEFT JOIN `joueurs` P2B on P2B.id = M.j2_bis
LEFT JOIN tennis_rankings R1 on R1.player = P1.id AND R1.id = IF(P1.sexe = 1, 'wta', 'atp')
LEFT JOIN tennis_rankings R1B on R1B.player = P1B.id AND R1B.id = IF(P1B.sexe = 1, 'wta', 'atp')
LEFT JOIN tennis_rankings R2 on R2.player = P2.id AND R2.id = IF(P2.sexe = 1, 'wta', 'atp')
LEFT JOIN tennis_rankings R2B on R2B.player = P2B.id AND R2B.id = IF(P2B.sexe = 1, 'wta', 'atp')
LEFT JOIN `livescores_new`.`matchs` LS ON (LS.tt_match_id = M.id)
LEFT JOIN tournois_programmes S on S.idm = M.id
LEFT JOIN lieux_courts CT on (CT.ids = S.ids && CT.ordre = S.court)
JOIN `leagues_rounds` LR on LR.id = M.league_round
JOIN `leagues` L on L.id = LR.league
JOIN tournois_name N on N.league = L.id
LEFT JOIN lieux_sites SL on SL.id = LR.site
LEFT JOIN lieux_villes SC on SC.id = SL.idv
LEFT JOIN lieux_pays SCO on SCO.code = SC.pays
WHERE
M.id = '4063832'
&& M.type_tournoi_add = 2
&& (S.statut = 0 || S.statut = 4 || S.statut = 2 || ISNULL(S.statut))
LIMIT 1
SELECT M.*
, M.time_start time_start
, M.time time_end
, M.duration_pause
, M.type_match_add type_match
, M.type_tournoi_add type_tournament
, M.niveau level
, M.qualif
, M.idw winner_id
, P1.id p1_id
, P1.nom p1_name
, P1.prenom p1_first_name
, P1.name_zh p1_name_zh
, P1.birthday p1_birthday
, P1.sexe p1_gender
, P1.nat p1_nat
, P1.photo p1_photo
, P1.taille p1_height
, P1.poids p1_weight
, R1.rank p1_rank
, R1.liveRank p1_rank_live
, P1.pro_depuis p1_turn_pro
, '?' p1_best_rank
, P1.prise p1_forehand
, P1.revers p1_backhand
, M.ts1 p1_seed
, P1B.id p1b_id
, P1B.nom p1b_name
, P1B.prenom p1b_first_name
, P1B.name_zh p1b_name_zh
, P1B.birthday p1b_birthday
, P1B.sexe p1b_gender
, P1B.nat p1b_nat
, P1B.photo p1b_photo
, P1B.taille p1b_height
, P1B.poids p1b_weight
, R1B.rank p1b_rank
, R1B.liveRank p1b_rank_live
, P1B.pro_depuis p1b_turn_pro
, P2.id p2_id
, P2.nom p2_name
, P2.prenom p2_first_name
, P2.name_zh p2_name_zh
, P2.birthday p2_birthday
, P2.sexe p2_gender
, P2.nat p2_nat
, P2.photo p2_photo
, P2.taille p2_height
, P2.poids p2_weight
, R2.rank p2_rank
, R2.liveRank p2_rank_live
, P2.pro_depuis p2_turn_pro
, '?' p2_best_rank
, P2.prise p2_forehand
, P2.revers p2_backhand
, M.ts2 p2_seed
, P2B.id p2b_id
, P2B.nom p2b_name
, P2B.prenom p2b_first_name
, P2B.name_zh p2b_name_zh
, P2B.birthday p2b_birthday
, P2B.sexe p2b_gender
, P2B.nat p2b_nat
, P2B.photo p2b_photo
, P2B.taille p2b_height
, P2B.poids p2b_weight
, R2B.rank p2b_rank
, R2B.liveRank p2b_rank_live
, P2B.pro_depuis p2b_turn_pro
, T.id tournament_id
, T.idt tournament_idt
, '?' rencontre_id
, N.name_fr tournament_name_fr
, N.name_en tournament_name_en
, N.name_zh tournament_name_zh
, N.name_de tournament_name_de
, N.name_es tournament_name_es
, T.ville tournament_city
, T.stade tournament_stadium
, T.surface tournament_surface
, T.surface_photo tournament_surface_photo
, T.surface_color tournament_surface_color
, T.monnaie tournament_currency
, T.prix tournament_prize_money
, SCO.nom_fr tournament_country
, T.logo tournament_logo
, T.debut tournament_start
, T.fin tournament_end
, T.nbj tournament_nbPlayer
, T.genre tournament_genre
, T.category tournament_category
, T.type tournament_type
, T.ids tournament_site
, T.year tournament_year
, T.importance tournament_importance
, '' team1
, '' team2
, T.importance
, T.background tournament_background
, SC.fuseau_horaire
, IF(ISNULL(LS.status) || M.status = 2 || M.status = 3 || M.status = 4, M.status, LS.status) match_status
, LS.serve
, S.time s_time_start
, S.court
, S.date_loc
, S.type s_type
, S.ordre s_order
, C.nom court_name
, C.ordre court_order
FROM
tournois_matchs M
INNER JOIN joueurs P1 on P1.id = M.j1
LEFT OUTER JOIN `joueurs` P1B on P1B.id = M.j1_bis
INNER JOIN joueurs P2 on P2.id = M.j2
LEFT OUTER JOIN `joueurs` P2B on P2B.id = M.j2_bis
LEFT JOIN tennis_rankings R1 on R1.player = P1.id AND R1.id = IF(P1.sexe = 1, 'wta', 'atp')
LEFT JOIN tennis_rankings R1B on R1B.player = P1B.id AND R1B.id = IF(P1B.sexe = 1, 'wta', 'atp')
LEFT JOIN tennis_rankings R2 on R2.player = P2.id AND R2.id = IF(P2.sexe = 1, 'wta', 'atp')
LEFT JOIN tennis_rankings R2B on R2B.player = P2B.id AND R2B.id = IF(P2B.sexe = 1, 'wta', 'atp')
INNER JOIN tournois T on T.id = M.idt
INNER JOIN tournois_name N on N.id = T.id && N.cup = 0
LEFT OUTER JOIN lieux_sites SL on T.ids = SL.id
LEFT OUTER JOIN lieux_villes SC on SL.idv = SC.id
LEFT OUTER JOIN lieux_pays SCO on SCO.code = SC.pays
LEFT OUTER JOIN `livescores_new`.`matchs` LS on LS.tt_match_id = M.id
LEFT OUTER JOIN tournois_programmes S on S.idm = M.id
LEFT OUTER JOIN lieux_courts C on C.ids = S.ids && C.ordre = S.court
WHERE
M.id = '4063808'
&& M.type_tournoi_add = 0
&& (S.statut = 0 || S.statut = 4 || S.statut = 2 || ISNULL(S.statut))
UNION
SELECT
M.*
, M.time_start time_start
, M.time time_end
, M.duration_pause
, M.type_match_add type_match
, M.type_tournoi_add type_tournament
, CR.niveau level
, M.qualif
, M.idw winner_id
, P1.id p1_id
, P1.nom p1_name
, P1.prenom p1_first_name
, P1.name_zh p1_name_zh
, P1.birthday p1_birthday
, P1.sexe p1_gender
, P1.nat p1_nat
, P1.photo p1_photo
, P1.taille p1_height
, P1.poids p1_weight
, R1.rank p1_rank
, R1.liveRank p1_rank_live
, P1.pro_depuis p1_turn_pro
, '?' p1_best_rank
, P1.prise p1_forehand
, P1.revers p1_backhand
, M.ts1 p1_seed
, P1B.id p1b_id
, P1B.nom p1b_name
, P1B.prenom p1b_first_name
, P1B.name_zh p1b_name_zh
, P1B.birthday p1b_birthday
, P1B.sexe p1b_gender
, P1B.nat p1b_nat
, P1B.photo p1b_photo
, P1B.taille p1b_height
, P1B.poids p1b_weight
, R1B.rank p1b_rank
, R1B.liveRank p1b_rank_live
, P1B.pro_depuis p1b_turn_pro
, P2.id p2_id
, P2.nom p2_name
, P2.prenom p2_first_name
, P2.name_zh p2_name_zh
, P2.birthday p2_birthday
, P2.sexe p2_gender
, P2.nat p2_nat
, P2.photo p2_photo
, P2.taille p2_height
, P2.poids p2_weight
, R2.rank p2_rank
, R2.liveRank p2_rank_live
, P2.pro_depuis p2_turn_pro
, '?' p2_best_rank
, P2.prise p2_forehand
, P2.revers p2_backhand
, M.ts2 p2_seed
, P2B.id p2b_id
, P2B.nom p2b_name
, P2B.prenom p2b_first_name
, P2B.name_zh p2b_name_zh
, P2B.birthday p2b_birthday
, P2B.sexe p2b_gender
, P2B.nat p2b_nat
, P2B.photo p2b_photo
, P2B.taille p2b_height
, P2B.poids p2b_weight
, R2B.rank p2b_rank
, R2B.liveRank p2b_rank_live
, P2B.pro_depuis p2b_turn_pro
, C.id tournament_id
, C.parent tournament_idt
, CR.id rencontre_id
, N.name_fr tournament_name_fr
, N.name_en tournament_name_en
, N.name_zh tournament_name_zh
, N.name_de tournament_name_de
, N.name_es tournament_name_es
, CONCAT(CR.equipe_domicile, '|', CR.equipe_exterieur) tournament_city
, '' tournament_stadium
, CR.surface tournament_surface
, '' tournament_surface_photo
, '0' tournament_surface_color
, '' tournament_currency
, '' tournament_prize_money
, SCO.nom_fr tournament_country
, '' tournament_logo
, CR.date_d tournament_start
, '' tournament_end
, C.nbj tournament_nbPlayer
, '' tournament_genre
, '' tournament_category
, '' tournament_type
, CR.lieu tournament_site
, '' tournament_year
, 65 tournament_importance
, IF(T1.nom_fr, T1.nom_fr, CR.equipe_domicile) team1
, IF(T2.nom_fr, T1.nom_fr, CR.equipe_exterieur) team2
, 65 importance
, '' tournament_background
, SC.fuseau_horaire
, IF(ISNULL(LS.status) || M.status = 2 || M.status = 3 || M.status = 4, M.status, LS.status) match_status
, LS.serve
, S.time s_time_start
, S.court
, S.date_loc
, S.type s_type
, S.ordre s_order
, CT.nom court_name
, CT.ordre court_order
FROM
tournois_matchs M
INNER JOIN joueurs P1 on P1.id = M.j1
LEFT OUTER JOIN `joueurs` P1B on P1B.id = M.j1_bis
INNER JOIN joueurs P2 on P2.id = M.j2
LEFT OUTER JOIN `joueurs` P2B on P2B.id = M.j2_bis
LEFT JOIN tennis_rankings R1 on R1.player = P1.id AND R1.id = IF(P1.sexe = 1, 'wta', 'atp')
LEFT JOIN tennis_rankings R1B on R1B.player = P1B.id AND R1B.id = IF(P1B.sexe = 1, 'wta', 'atp')
LEFT JOIN tennis_rankings R2 on R2.player = P2.id AND R2.id = IF(P2.sexe = 1, 'wta', 'atp')
LEFT JOIN tennis_rankings R2B on R2B.player = P2B.id AND R2B.id = IF(P2B.sexe = 1, 'wta', 'atp')
LEFT OUTER JOIN `livescores_new`.`matchs` LS ON (LS.tt_match_id = M.id)
LEFT OUTER JOIN tournois_programmes S on S.idm = M.id
LEFT OUTER JOIN lieux_courts CT on (CT.ids = S.ids && CT.ordre = S.court)
INNER JOIN `coupes_rencontres` CR on CR.id = M.idt
INNER JOIN `coupes` C on C.id = CR.coupe_id
INNER JOIN tournois_name N on N.id = C.id
LEFT JOIN lieux_sites SL on SL.id = CR.lieu
LEFT JOIN lieux_villes SC on SC.id = SL.idv
LEFT JOIN lieux_pays SCO on SCO.code = SC.pays
LEFT JOIN `lieux_pays` T1 ON (T1.code = CR.equipe_domicile)
LEFT JOIN `lieux_pays` T2 ON (T2.code = CR.equipe_exterieur)
WHERE
M.id = '4063808'
&& M.type_tournoi_add = 1
&& (S.statut = 0 || S.statut = 4 || S.statut = 2 || ISNULL(S.statut))
UNION
SELECT
M.*
, M.time_start time_start
, M.time time_end
, M.duration_pause
, M.type_match_add type_match
, M.type_tournoi_add type_tournament
, '' level
, M.qualif
, M.idw winner_id
, P1.id p1_id
, P1.nom p1_name
, P1.prenom p1_first_name
, P1.name_zh p1_name_zh
, P1.birthday p1_birthday
, P1.sexe p1_gender
, P1.nat p1_nat
, P1.photo p1_photo
, P1.taille p1_height
, P1.poids p1_weight
, R1.rank p1_rank
, R1.liveRank p1_rank_live
, P1.pro_depuis p1_turn_pro
, '?' p1_best_rank
, P1.prise p1_forehand
, P1.revers p1_backhand
, M.ts1 p1_seed
, P1B.id p1b_id
, P1B.nom p1b_name
, P1B.prenom p1b_first_name
, P1B.name_zh p1b_name_zh
, P1B.birthday p1b_birthday
, P1B.sexe p1b_gender
, P1B.nat p1b_nat
, P1B.photo p1b_photo
, P1B.taille p1b_height
, P1B.poids p1b_weight
, R1B.rank p1b_rank
, R1B.liveRank p1b_rank_live
, P1B.pro_depuis p1b_turn_pro
, P2.id p2_id
, P2.nom p2_name
, P2.prenom p2_first_name
, P2.name_zh p2_name_zh
, P2.birthday p2_birthday
, P2.sexe p2_gender
, P2.nat p2_nat
, P2.photo p2_photo
, P2.taille p2_height
, P2.poids p2_weight
, R2.rank p2_rank
, R2.liveRank p2_rank_live
, P2.pro_depuis p2_turn_pro
, '?' p2_best_rank
, P2.prise p2_forehand
, P2.revers p2_backhand
, M.ts2 p2_seed
, P2B.id p2b_id
, P2B.nom p2b_name
, P2B.prenom p2b_first_name
, P2B.name_zh p2b_name_zh
, P2B.birthday p2b_birthday
, P2B.sexe p2b_gender
, P2B.nat p2b_nat
, P2B.photo p2b_photo
, P2B.taille p2b_height
, P2B.poids p2b_weight
, R2B.rank p2b_rank
, R2B.liveRank p2b_rank_live
, P2B.pro_depuis p2b_turn_pro
, L.id tournament_id
, 0 tournament_idt
, LR.id rencontre_id
, N.name_fr tournament_name_fr
, N.name_en tournament_name_en
, N.name_zh tournament_name_zh
, N.name_de tournament_name_de
, N.name_es tournament_name_es
, SC.nom tournament_city
, '' tournament_stadium
, '3' tournament_surface
, '' tournament_surface_photo
, '0' tournament_surface_color
, '' tournament_currency
, '' tournament_prize_money
, SCO.nom_fr tournament_country
, '' tournament_logo
, L.time_start tournament_start
, '' tournament_end
, '' tournament_nbPlayer
, '' tournament_genre
, '' tournament_category
, '' tournament_type
, LR.site tournament_site
, L.year tournament_year
, 0 tournament_importance
, '' team1
, '' team2
, 3 importance
, '' tournament_background
, SC.fuseau_horaire
, IF(ISNULL(LS.status) || M.status = 2 || M.status = 3 || M.status = 4, M.status, LS.status) match_status
, LS.serve
, S.time s_time_start
, S.court
, S.date_loc
, S.type s_type
, S.ordre s_order
, CT.nom court_name
, CT.ordre court_order
FROM
tournois_matchs M
JOIN joueurs P1 on P1.id = M.j1
LEFT JOIN `joueurs` P1B on P1B.id = M.j1_bis
JOIN joueurs P2 on P2.id = M.j2
LEFT JOIN `joueurs` P2B on P2B.id = M.j2_bis
LEFT JOIN tennis_rankings R1 on R1.player = P1.id AND R1.id = IF(P1.sexe = 1, 'wta', 'atp')
LEFT JOIN tennis_rankings R1B on R1B.player = P1B.id AND R1B.id = IF(P1B.sexe = 1, 'wta', 'atp')
LEFT JOIN tennis_rankings R2 on R2.player = P2.id AND R2.id = IF(P2.sexe = 1, 'wta', 'atp')
LEFT JOIN tennis_rankings R2B on R2B.player = P2B.id AND R2B.id = IF(P2B.sexe = 1, 'wta', 'atp')
LEFT JOIN `livescores_new`.`matchs` LS ON (LS.tt_match_id = M.id)
LEFT JOIN tournois_programmes S on S.idm = M.id
LEFT JOIN lieux_courts CT on (CT.ids = S.ids && CT.ordre = S.court)
JOIN `leagues_rounds` LR on LR.id = M.league_round
JOIN `leagues` L on L.id = LR.league
JOIN tournois_name N on N.league = L.id
LEFT JOIN lieux_sites SL on SL.id = LR.site
LEFT JOIN lieux_villes SC on SC.id = SL.idv
LEFT JOIN lieux_pays SCO on SCO.code = SC.pays
WHERE
M.id = '4063808'
&& M.type_tournoi_add = 2
&& (S.statut = 0 || S.statut = 4 || S.statut = 2 || ISNULL(S.statut))
LIMIT 1
SELECT M.*
, M.time_start time_start
, M.time time_end
, M.duration_pause
, M.type_match_add type_match
, M.type_tournoi_add type_tournament
, M.niveau level
, M.qualif
, M.idw winner_id
, P1.id p1_id
, P1.nom p1_name
, P1.prenom p1_first_name
, P1.name_zh p1_name_zh
, P1.birthday p1_birthday
, P1.sexe p1_gender
, P1.nat p1_nat
, P1.photo p1_photo
, P1.taille p1_height
, P1.poids p1_weight
, R1.rank p1_rank
, R1.liveRank p1_rank_live
, P1.pro_depuis p1_turn_pro
, '?' p1_best_rank
, P1.prise p1_forehand
, P1.revers p1_backhand
, M.ts1 p1_seed
, P1B.id p1b_id
, P1B.nom p1b_name
, P1B.prenom p1b_first_name
, P1B.name_zh p1b_name_zh
, P1B.birthday p1b_birthday
, P1B.sexe p1b_gender
, P1B.nat p1b_nat
, P1B.photo p1b_photo
, P1B.taille p1b_height
, P1B.poids p1b_weight
, R1B.rank p1b_rank
, R1B.liveRank p1b_rank_live
, P1B.pro_depuis p1b_turn_pro
, P2.id p2_id
, P2.nom p2_name
, P2.prenom p2_first_name
, P2.name_zh p2_name_zh
, P2.birthday p2_birthday
, P2.sexe p2_gender
, P2.nat p2_nat
, P2.photo p2_photo
, P2.taille p2_height
, P2.poids p2_weight
, R2.rank p2_rank
, R2.liveRank p2_rank_live
, P2.pro_depuis p2_turn_pro
, '?' p2_best_rank
, P2.prise p2_forehand
, P2.revers p2_backhand
, M.ts2 p2_seed
, P2B.id p2b_id
, P2B.nom p2b_name
, P2B.prenom p2b_first_name
, P2B.name_zh p2b_name_zh
, P2B.birthday p2b_birthday
, P2B.sexe p2b_gender
, P2B.nat p2b_nat
, P2B.photo p2b_photo
, P2B.taille p2b_height
, P2B.poids p2b_weight
, R2B.rank p2b_rank
, R2B.liveRank p2b_rank_live
, P2B.pro_depuis p2b_turn_pro
, T.id tournament_id
, T.idt tournament_idt
, '?' rencontre_id
, N.name_fr tournament_name_fr
, N.name_en tournament_name_en
, N.name_zh tournament_name_zh
, N.name_de tournament_name_de
, N.name_es tournament_name_es
, T.ville tournament_city
, T.stade tournament_stadium
, T.surface tournament_surface
, T.surface_photo tournament_surface_photo
, T.surface_color tournament_surface_color
, T.monnaie tournament_currency
, T.prix tournament_prize_money
, SCO.nom_fr tournament_country
, T.logo tournament_logo
, T.debut tournament_start
, T.fin tournament_end
, T.nbj tournament_nbPlayer
, T.genre tournament_genre
, T.category tournament_category
, T.type tournament_type
, T.ids tournament_site
, T.year tournament_year
, T.importance tournament_importance
, '' team1
, '' team2
, T.importance
, T.background tournament_background
, SC.fuseau_horaire
, IF(ISNULL(LS.status) || M.status = 2 || M.status = 3 || M.status = 4, M.status, LS.status) match_status
, LS.serve
, S.time s_time_start
, S.court
, S.date_loc
, S.type s_type
, S.ordre s_order
, C.nom court_name
, C.ordre court_order
FROM
tournois_matchs M
INNER JOIN joueurs P1 on P1.id = M.j1
LEFT OUTER JOIN `joueurs` P1B on P1B.id = M.j1_bis
INNER JOIN joueurs P2 on P2.id = M.j2
LEFT OUTER JOIN `joueurs` P2B on P2B.id = M.j2_bis
LEFT JOIN tennis_rankings R1 on R1.player = P1.id AND R1.id = IF(P1.sexe = 1, 'wta', 'atp')
LEFT JOIN tennis_rankings R1B on R1B.player = P1B.id AND R1B.id = IF(P1B.sexe = 1, 'wta', 'atp')
LEFT JOIN tennis_rankings R2 on R2.player = P2.id AND R2.id = IF(P2.sexe = 1, 'wta', 'atp')
LEFT JOIN tennis_rankings R2B on R2B.player = P2B.id AND R2B.id = IF(P2B.sexe = 1, 'wta', 'atp')
INNER JOIN tournois T on T.id = M.idt
INNER JOIN tournois_name N on N.id = T.id && N.cup = 0
LEFT OUTER JOIN lieux_sites SL on T.ids = SL.id
LEFT OUTER JOIN lieux_villes SC on SL.idv = SC.id
LEFT OUTER JOIN lieux_pays SCO on SCO.code = SC.pays
LEFT OUTER JOIN `livescores_new`.`matchs` LS on LS.tt_match_id = M.id
LEFT OUTER JOIN tournois_programmes S on S.idm = M.id
LEFT OUTER JOIN lieux_courts C on C.ids = S.ids && C.ordre = S.court
WHERE
M.id = '4063816'
&& M.type_tournoi_add = 0
&& (S.statut = 0 || S.statut = 4 || S.statut = 2 || ISNULL(S.statut))
UNION
SELECT
M.*
, M.time_start time_start
, M.time time_end
, M.duration_pause
, M.type_match_add type_match
, M.type_tournoi_add type_tournament
, CR.niveau level
, M.qualif
, M.idw winner_id
, P1.id p1_id
, P1.nom p1_name
, P1.prenom p1_first_name
, P1.name_zh p1_name_zh
, P1.birthday p1_birthday
, P1.sexe p1_gender
, P1.nat p1_nat
, P1.photo p1_photo
, P1.taille p1_height
, P1.poids p1_weight
, R1.rank p1_rank
, R1.liveRank p1_rank_live
, P1.pro_depuis p1_turn_pro
, '?' p1_best_rank
, P1.prise p1_forehand
, P1.revers p1_backhand
, M.ts1 p1_seed
, P1B.id p1b_id
, P1B.nom p1b_name
, P1B.prenom p1b_first_name
, P1B.name_zh p1b_name_zh
, P1B.birthday p1b_birthday
, P1B.sexe p1b_gender
, P1B.nat p1b_nat
, P1B.photo p1b_photo
, P1B.taille p1b_height
, P1B.poids p1b_weight
, R1B.rank p1b_rank
, R1B.liveRank p1b_rank_live
, P1B.pro_depuis p1b_turn_pro
, P2.id p2_id
, P2.nom p2_name
, P2.prenom p2_first_name
, P2.name_zh p2_name_zh
, P2.birthday p2_birthday
, P2.sexe p2_gender
, P2.nat p2_nat
, P2.photo p2_photo
, P2.taille p2_height
, P2.poids p2_weight
, R2.rank p2_rank
, R2.liveRank p2_rank_live
, P2.pro_depuis p2_turn_pro
, '?' p2_best_rank
, P2.prise p2_forehand
, P2.revers p2_backhand
, M.ts2 p2_seed
, P2B.id p2b_id
, P2B.nom p2b_name
, P2B.prenom p2b_first_name
, P2B.name_zh p2b_name_zh
, P2B.birthday p2b_birthday
, P2B.sexe p2b_gender
, P2B.nat p2b_nat
, P2B.photo p2b_photo
, P2B.taille p2b_height
, P2B.poids p2b_weight
, R2B.rank p2b_rank
, R2B.liveRank p2b_rank_live
, P2B.pro_depuis p2b_turn_pro
, C.id tournament_id
, C.parent tournament_idt
, CR.id rencontre_id
, N.name_fr tournament_name_fr
, N.name_en tournament_name_en
, N.name_zh tournament_name_zh
, N.name_de tournament_name_de
, N.name_es tournament_name_es
, CONCAT(CR.equipe_domicile, '|', CR.equipe_exterieur) tournament_city
, '' tournament_stadium
, CR.surface tournament_surface
, '' tournament_surface_photo
, '0' tournament_surface_color
, '' tournament_currency
, '' tournament_prize_money
, SCO.nom_fr tournament_country
, '' tournament_logo
, CR.date_d tournament_start
, '' tournament_end
, C.nbj tournament_nbPlayer
, '' tournament_genre
, '' tournament_category
, '' tournament_type
, CR.lieu tournament_site
, '' tournament_year
, 65 tournament_importance
, IF(T1.nom_fr, T1.nom_fr, CR.equipe_domicile) team1
, IF(T2.nom_fr, T1.nom_fr, CR.equipe_exterieur) team2
, 65 importance
, '' tournament_background
, SC.fuseau_horaire
, IF(ISNULL(LS.status) || M.status = 2 || M.status = 3 || M.status = 4, M.status, LS.status) match_status
, LS.serve
, S.time s_time_start
, S.court
, S.date_loc
, S.type s_type
, S.ordre s_order
, CT.nom court_name
, CT.ordre court_order
FROM
tournois_matchs M
INNER JOIN joueurs P1 on P1.id = M.j1
LEFT OUTER JOIN `joueurs` P1B on P1B.id = M.j1_bis
INNER JOIN joueurs P2 on P2.id = M.j2
LEFT OUTER JOIN `joueurs` P2B on P2B.id = M.j2_bis
LEFT JOIN tennis_rankings R1 on R1.player = P1.id AND R1.id = IF(P1.sexe = 1, 'wta', 'atp')
LEFT JOIN tennis_rankings R1B on R1B.player = P1B.id AND R1B.id = IF(P1B.sexe = 1, 'wta', 'atp')
LEFT JOIN tennis_rankings R2 on R2.player = P2.id AND R2.id = IF(P2.sexe = 1, 'wta', 'atp')
LEFT JOIN tennis_rankings R2B on R2B.player = P2B.id AND R2B.id = IF(P2B.sexe = 1, 'wta', 'atp')
LEFT OUTER JOIN `livescores_new`.`matchs` LS ON (LS.tt_match_id = M.id)
LEFT OUTER JOIN tournois_programmes S on S.idm = M.id
LEFT OUTER JOIN lieux_courts CT on (CT.ids = S.ids && CT.ordre = S.court)
INNER JOIN `coupes_rencontres` CR on CR.id = M.idt
INNER JOIN `coupes` C on C.id = CR.coupe_id
INNER JOIN tournois_name N on N.id = C.id
LEFT JOIN lieux_sites SL on SL.id = CR.lieu
LEFT JOIN lieux_villes SC on SC.id = SL.idv
LEFT JOIN lieux_pays SCO on SCO.code = SC.pays
LEFT JOIN `lieux_pays` T1 ON (T1.code = CR.equipe_domicile)
LEFT JOIN `lieux_pays` T2 ON (T2.code = CR.equipe_exterieur)
WHERE
M.id = '4063816'
&& M.type_tournoi_add = 1
&& (S.statut = 0 || S.statut = 4 || S.statut = 2 || ISNULL(S.statut))
UNION
SELECT
M.*
, M.time_start time_start
, M.time time_end
, M.duration_pause
, M.type_match_add type_match
, M.type_tournoi_add type_tournament
, '' level
, M.qualif
, M.idw winner_id
, P1.id p1_id
, P1.nom p1_name
, P1.prenom p1_first_name
, P1.name_zh p1_name_zh
, P1.birthday p1_birthday
, P1.sexe p1_gender
, P1.nat p1_nat
, P1.photo p1_photo
, P1.taille p1_height
, P1.poids p1_weight
, R1.rank p1_rank
, R1.liveRank p1_rank_live
, P1.pro_depuis p1_turn_pro
, '?' p1_best_rank
, P1.prise p1_forehand
, P1.revers p1_backhand
, M.ts1 p1_seed
, P1B.id p1b_id
, P1B.nom p1b_name
, P1B.prenom p1b_first_name
, P1B.name_zh p1b_name_zh
, P1B.birthday p1b_birthday
, P1B.sexe p1b_gender
, P1B.nat p1b_nat
, P1B.photo p1b_photo
, P1B.taille p1b_height
, P1B.poids p1b_weight
, R1B.rank p1b_rank
, R1B.liveRank p1b_rank_live
, P1B.pro_depuis p1b_turn_pro
, P2.id p2_id
, P2.nom p2_name
, P2.prenom p2_first_name
, P2.name_zh p2_name_zh
, P2.birthday p2_birthday
, P2.sexe p2_gender
, P2.nat p2_nat
, P2.photo p2_photo
, P2.taille p2_height
, P2.poids p2_weight
, R2.rank p2_rank
, R2.liveRank p2_rank_live
, P2.pro_depuis p2_turn_pro
, '?' p2_best_rank
, P2.prise p2_forehand
, P2.revers p2_backhand
, M.ts2 p2_seed
, P2B.id p2b_id
, P2B.nom p2b_name
, P2B.prenom p2b_first_name
, P2B.name_zh p2b_name_zh
, P2B.birthday p2b_birthday
, P2B.sexe p2b_gender
, P2B.nat p2b_nat
, P2B.photo p2b_photo
, P2B.taille p2b_height
, P2B.poids p2b_weight
, R2B.rank p2b_rank
, R2B.liveRank p2b_rank_live
, P2B.pro_depuis p2b_turn_pro
, L.id tournament_id
, 0 tournament_idt
, LR.id rencontre_id
, N.name_fr tournament_name_fr
, N.name_en tournament_name_en
, N.name_zh tournament_name_zh
, N.name_de tournament_name_de
, N.name_es tournament_name_es
, SC.nom tournament_city
, '' tournament_stadium
, '3' tournament_surface
, '' tournament_surface_photo
, '0' tournament_surface_color
, '' tournament_currency
, '' tournament_prize_money
, SCO.nom_fr tournament_country
, '' tournament_logo
, L.time_start tournament_start
, '' tournament_end
, '' tournament_nbPlayer
, '' tournament_genre
, '' tournament_category
, '' tournament_type
, LR.site tournament_site
, L.year tournament_year
, 0 tournament_importance
, '' team1
, '' team2
, 3 importance
, '' tournament_background
, SC.fuseau_horaire
, IF(ISNULL(LS.status) || M.status = 2 || M.status = 3 || M.status = 4, M.status, LS.status) match_status
, LS.serve
, S.time s_time_start
, S.court
, S.date_loc
, S.type s_type
, S.ordre s_order
, CT.nom court_name
, CT.ordre court_order
FROM
tournois_matchs M
JOIN joueurs P1 on P1.id = M.j1
LEFT JOIN `joueurs` P1B on P1B.id = M.j1_bis
JOIN joueurs P2 on P2.id = M.j2
LEFT JOIN `joueurs` P2B on P2B.id = M.j2_bis
LEFT JOIN tennis_rankings R1 on R1.player = P1.id AND R1.id = IF(P1.sexe = 1, 'wta', 'atp')
LEFT JOIN tennis_rankings R1B on R1B.player = P1B.id AND R1B.id = IF(P1B.sexe = 1, 'wta', 'atp')
LEFT JOIN tennis_rankings R2 on R2.player = P2.id AND R2.id = IF(P2.sexe = 1, 'wta', 'atp')
LEFT JOIN tennis_rankings R2B on R2B.player = P2B.id AND R2B.id = IF(P2B.sexe = 1, 'wta', 'atp')
LEFT JOIN `livescores_new`.`matchs` LS ON (LS.tt_match_id = M.id)
LEFT JOIN tournois_programmes S on S.idm = M.id
LEFT JOIN lieux_courts CT on (CT.ids = S.ids && CT.ordre = S.court)
JOIN `leagues_rounds` LR on LR.id = M.league_round
JOIN `leagues` L on L.id = LR.league
JOIN tournois_name N on N.league = L.id
LEFT JOIN lieux_sites SL on SL.id = LR.site
LEFT JOIN lieux_villes SC on SC.id = SL.idv
LEFT JOIN lieux_pays SCO on SCO.code = SC.pays
WHERE
M.id = '4063816'
&& M.type_tournoi_add = 2
&& (S.statut = 0 || S.statut = 4 || S.statut = 2 || ISNULL(S.statut))
LIMIT 1
SELECT M.*
, M.time_start time_start
, M.time time_end
, M.duration_pause
, M.type_match_add type_match
, M.type_tournoi_add type_tournament
, M.niveau level
, M.qualif
, M.idw winner_id
, P1.id p1_id
, P1.nom p1_name
, P1.prenom p1_first_name
, P1.name_zh p1_name_zh
, P1.birthday p1_birthday
, P1.sexe p1_gender
, P1.nat p1_nat
, P1.photo p1_photo
, P1.taille p1_height
, P1.poids p1_weight
, R1.rank p1_rank
, R1.liveRank p1_rank_live
, P1.pro_depuis p1_turn_pro
, '?' p1_best_rank
, P1.prise p1_forehand
, P1.revers p1_backhand
, M.ts1 p1_seed
, P1B.id p1b_id
, P1B.nom p1b_name
, P1B.prenom p1b_first_name
, P1B.name_zh p1b_name_zh
, P1B.birthday p1b_birthday
, P1B.sexe p1b_gender
, P1B.nat p1b_nat
, P1B.photo p1b_photo
, P1B.taille p1b_height
, P1B.poids p1b_weight
, R1B.rank p1b_rank
, R1B.liveRank p1b_rank_live
, P1B.pro_depuis p1b_turn_pro
, P2.id p2_id
, P2.nom p2_name
, P2.prenom p2_first_name
, P2.name_zh p2_name_zh
, P2.birthday p2_birthday
, P2.sexe p2_gender
, P2.nat p2_nat
, P2.photo p2_photo
, P2.taille p2_height
, P2.poids p2_weight
, R2.rank p2_rank
, R2.liveRank p2_rank_live
, P2.pro_depuis p2_turn_pro
, '?' p2_best_rank
, P2.prise p2_forehand
, P2.revers p2_backhand
, M.ts2 p2_seed
, P2B.id p2b_id
, P2B.nom p2b_name
, P2B.prenom p2b_first_name
, P2B.name_zh p2b_name_zh
, P2B.birthday p2b_birthday
, P2B.sexe p2b_gender
, P2B.nat p2b_nat
, P2B.photo p2b_photo
, P2B.taille p2b_height
, P2B.poids p2b_weight
, R2B.rank p2b_rank
, R2B.liveRank p2b_rank_live
, P2B.pro_depuis p2b_turn_pro
, T.id tournament_id
, T.idt tournament_idt
, '?' rencontre_id
, N.name_fr tournament_name_fr
, N.name_en tournament_name_en
, N.name_zh tournament_name_zh
, N.name_de tournament_name_de
, N.name_es tournament_name_es
, T.ville tournament_city
, T.stade tournament_stadium
, T.surface tournament_surface
, T.surface_photo tournament_surface_photo
, T.surface_color tournament_surface_color
, T.monnaie tournament_currency
, T.prix tournament_prize_money
, SCO.nom_fr tournament_country
, T.logo tournament_logo
, T.debut tournament_start
, T.fin tournament_end
, T.nbj tournament_nbPlayer
, T.genre tournament_genre
, T.category tournament_category
, T.type tournament_type
, T.ids tournament_site
, T.year tournament_year
, T.importance tournament_importance
, '' team1
, '' team2
, T.importance
, T.background tournament_background
, SC.fuseau_horaire
, IF(ISNULL(LS.status) || M.status = 2 || M.status = 3 || M.status = 4, M.status, LS.status) match_status
, LS.serve
, S.time s_time_start
, S.court
, S.date_loc
, S.type s_type
, S.ordre s_order
, C.nom court_name
, C.ordre court_order
FROM
tournois_matchs M
INNER JOIN joueurs P1 on P1.id = M.j1
LEFT OUTER JOIN `joueurs` P1B on P1B.id = M.j1_bis
INNER JOIN joueurs P2 on P2.id = M.j2
LEFT OUTER JOIN `joueurs` P2B on P2B.id = M.j2_bis
LEFT JOIN tennis_rankings R1 on R1.player = P1.id AND R1.id = IF(P1.sexe = 1, 'wta', 'atp')
LEFT JOIN tennis_rankings R1B on R1B.player = P1B.id AND R1B.id = IF(P1B.sexe = 1, 'wta', 'atp')
LEFT JOIN tennis_rankings R2 on R2.player = P2.id AND R2.id = IF(P2.sexe = 1, 'wta', 'atp')
LEFT JOIN tennis_rankings R2B on R2B.player = P2B.id AND R2B.id = IF(P2B.sexe = 1, 'wta', 'atp')
INNER JOIN tournois T on T.id = M.idt
INNER JOIN tournois_name N on N.id = T.id && N.cup = 0
LEFT OUTER JOIN lieux_sites SL on T.ids = SL.id
LEFT OUTER JOIN lieux_villes SC on SL.idv = SC.id
LEFT OUTER JOIN lieux_pays SCO on SCO.code = SC.pays
LEFT OUTER JOIN `livescores_new`.`matchs` LS on LS.tt_match_id = M.id
LEFT OUTER JOIN tournois_programmes S on S.idm = M.id
LEFT OUTER JOIN lieux_courts C on C.ids = S.ids && C.ordre = S.court
WHERE
M.id = '9432687'
&& M.type_tournoi_add = 0
&& (S.statut = 0 || S.statut = 4 || S.statut = 2 || ISNULL(S.statut))
UNION
SELECT
M.*
, M.time_start time_start
, M.time time_end
, M.duration_pause
, M.type_match_add type_match
, M.type_tournoi_add type_tournament
, CR.niveau level
, M.qualif
, M.idw winner_id
, P1.id p1_id
, P1.nom p1_name
, P1.prenom p1_first_name
, P1.name_zh p1_name_zh
, P1.birthday p1_birthday
, P1.sexe p1_gender
, P1.nat p1_nat
, P1.photo p1_photo
, P1.taille p1_height
, P1.poids p1_weight
, R1.rank p1_rank
, R1.liveRank p1_rank_live
, P1.pro_depuis p1_turn_pro
, '?' p1_best_rank
, P1.prise p1_forehand
, P1.revers p1_backhand
, M.ts1 p1_seed
, P1B.id p1b_id
, P1B.nom p1b_name
, P1B.prenom p1b_first_name
, P1B.name_zh p1b_name_zh
, P1B.birthday p1b_birthday
, P1B.sexe p1b_gender
, P1B.nat p1b_nat
, P1B.photo p1b_photo
, P1B.taille p1b_height
, P1B.poids p1b_weight
, R1B.rank p1b_rank
, R1B.liveRank p1b_rank_live
, P1B.pro_depuis p1b_turn_pro
, P2.id p2_id
, P2.nom p2_name
, P2.prenom p2_first_name
, P2.name_zh p2_name_zh
, P2.birthday p2_birthday
, P2.sexe p2_gender
, P2.nat p2_nat
, P2.photo p2_photo
, P2.taille p2_height
, P2.poids p2_weight
, R2.rank p2_rank
, R2.liveRank p2_rank_live
, P2.pro_depuis p2_turn_pro
, '?' p2_best_rank
, P2.prise p2_forehand
, P2.revers p2_backhand
, M.ts2 p2_seed
, P2B.id p2b_id
, P2B.nom p2b_name
, P2B.prenom p2b_first_name
, P2B.name_zh p2b_name_zh
, P2B.birthday p2b_birthday
, P2B.sexe p2b_gender
, P2B.nat p2b_nat
, P2B.photo p2b_photo
, P2B.taille p2b_height
, P2B.poids p2b_weight
, R2B.rank p2b_rank
, R2B.liveRank p2b_rank_live
, P2B.pro_depuis p2b_turn_pro
, C.id tournament_id
, C.parent tournament_idt
, CR.id rencontre_id
, N.name_fr tournament_name_fr
, N.name_en tournament_name_en
, N.name_zh tournament_name_zh
, N.name_de tournament_name_de
, N.name_es tournament_name_es
, CONCAT(CR.equipe_domicile, '|', CR.equipe_exterieur) tournament_city
, '' tournament_stadium
, CR.surface tournament_surface
, '' tournament_surface_photo
, '0' tournament_surface_color
, '' tournament_currency
, '' tournament_prize_money
, SCO.nom_fr tournament_country
, '' tournament_logo
, CR.date_d tournament_start
, '' tournament_end
, C.nbj tournament_nbPlayer
, '' tournament_genre
, '' tournament_category
, '' tournament_type
, CR.lieu tournament_site
, '' tournament_year
, 65 tournament_importance
, IF(T1.nom_fr, T1.nom_fr, CR.equipe_domicile) team1
, IF(T2.nom_fr, T1.nom_fr, CR.equipe_exterieur) team2
, 65 importance
, '' tournament_background
, SC.fuseau_horaire
, IF(ISNULL(LS.status) || M.status = 2 || M.status = 3 || M.status = 4, M.status, LS.status) match_status
, LS.serve
, S.time s_time_start
, S.court
, S.date_loc
, S.type s_type
, S.ordre s_order
, CT.nom court_name
, CT.ordre court_order
FROM
tournois_matchs M
INNER JOIN joueurs P1 on P1.id = M.j1
LEFT OUTER JOIN `joueurs` P1B on P1B.id = M.j1_bis
INNER JOIN joueurs P2 on P2.id = M.j2
LEFT OUTER JOIN `joueurs` P2B on P2B.id = M.j2_bis
LEFT JOIN tennis_rankings R1 on R1.player = P1.id AND R1.id = IF(P1.sexe = 1, 'wta', 'atp')
LEFT JOIN tennis_rankings R1B on R1B.player = P1B.id AND R1B.id = IF(P1B.sexe = 1, 'wta', 'atp')
LEFT JOIN tennis_rankings R2 on R2.player = P2.id AND R2.id = IF(P2.sexe = 1, 'wta', 'atp')
LEFT JOIN tennis_rankings R2B on R2B.player = P2B.id AND R2B.id = IF(P2B.sexe = 1, 'wta', 'atp')
LEFT OUTER JOIN `livescores_new`.`matchs` LS ON (LS.tt_match_id = M.id)
LEFT OUTER JOIN tournois_programmes S on S.idm = M.id
LEFT OUTER JOIN lieux_courts CT on (CT.ids = S.ids && CT.ordre = S.court)
INNER JOIN `coupes_rencontres` CR on CR.id = M.idt
INNER JOIN `coupes` C on C.id = CR.coupe_id
INNER JOIN tournois_name N on N.id = C.id
LEFT JOIN lieux_sites SL on SL.id = CR.lieu
LEFT JOIN lieux_villes SC on SC.id = SL.idv
LEFT JOIN lieux_pays SCO on SCO.code = SC.pays
LEFT JOIN `lieux_pays` T1 ON (T1.code = CR.equipe_domicile)
LEFT JOIN `lieux_pays` T2 ON (T2.code = CR.equipe_exterieur)
WHERE
M.id = '9432687'
&& M.type_tournoi_add = 1
&& (S.statut = 0 || S.statut = 4 || S.statut = 2 || ISNULL(S.statut))
UNION
SELECT
M.*
, M.time_start time_start
, M.time time_end
, M.duration_pause
, M.type_match_add type_match
, M.type_tournoi_add type_tournament
, '' level
, M.qualif
, M.idw winner_id
, P1.id p1_id
, P1.nom p1_name
, P1.prenom p1_first_name
, P1.name_zh p1_name_zh
, P1.birthday p1_birthday
, P1.sexe p1_gender
, P1.nat p1_nat
, P1.photo p1_photo
, P1.taille p1_height
, P1.poids p1_weight
, R1.rank p1_rank
, R1.liveRank p1_rank_live
, P1.pro_depuis p1_turn_pro
, '?' p1_best_rank
, P1.prise p1_forehand
, P1.revers p1_backhand
, M.ts1 p1_seed
, P1B.id p1b_id
, P1B.nom p1b_name
, P1B.prenom p1b_first_name
, P1B.name_zh p1b_name_zh
, P1B.birthday p1b_birthday
, P1B.sexe p1b_gender
, P1B.nat p1b_nat
, P1B.photo p1b_photo
, P1B.taille p1b_height
, P1B.poids p1b_weight
, R1B.rank p1b_rank
, R1B.liveRank p1b_rank_live
, P1B.pro_depuis p1b_turn_pro
, P2.id p2_id
, P2.nom p2_name
, P2.prenom p2_first_name
, P2.name_zh p2_name_zh
, P2.birthday p2_birthday
, P2.sexe p2_gender
, P2.nat p2_nat
, P2.photo p2_photo
, P2.taille p2_height
, P2.poids p2_weight
, R2.rank p2_rank
, R2.liveRank p2_rank_live
, P2.pro_depuis p2_turn_pro
, '?' p2_best_rank
, P2.prise p2_forehand
, P2.revers p2_backhand
, M.ts2 p2_seed
, P2B.id p2b_id
, P2B.nom p2b_name
, P2B.prenom p2b_first_name
, P2B.name_zh p2b_name_zh
, P2B.birthday p2b_birthday
, P2B.sexe p2b_gender
, P2B.nat p2b_nat
, P2B.photo p2b_photo
, P2B.taille p2b_height
, P2B.poids p2b_weight
, R2B.rank p2b_rank
, R2B.liveRank p2b_rank_live
, P2B.pro_depuis p2b_turn_pro
, L.id tournament_id
, 0 tournament_idt
, LR.id rencontre_id
, N.name_fr tournament_name_fr
, N.name_en tournament_name_en
, N.name_zh tournament_name_zh
, N.name_de tournament_name_de
, N.name_es tournament_name_es
, SC.nom tournament_city
, '' tournament_stadium
, '3' tournament_surface
, '' tournament_surface_photo
, '0' tournament_surface_color
, '' tournament_currency
, '' tournament_prize_money
, SCO.nom_fr tournament_country
, '' tournament_logo
, L.time_start tournament_start
, '' tournament_end
, '' tournament_nbPlayer
, '' tournament_genre
, '' tournament_category
, '' tournament_type
, LR.site tournament_site
, L.year tournament_year
, 0 tournament_importance
, '' team1
, '' team2
, 3 importance
, '' tournament_background
, SC.fuseau_horaire
, IF(ISNULL(LS.status) || M.status = 2 || M.status = 3 || M.status = 4, M.status, LS.status) match_status
, LS.serve
, S.time s_time_start
, S.court
, S.date_loc
, S.type s_type
, S.ordre s_order
, CT.nom court_name
, CT.ordre court_order
FROM
tournois_matchs M
JOIN joueurs P1 on P1.id = M.j1
LEFT JOIN `joueurs` P1B on P1B.id = M.j1_bis
JOIN joueurs P2 on P2.id = M.j2
LEFT JOIN `joueurs` P2B on P2B.id = M.j2_bis
LEFT JOIN tennis_rankings R1 on R1.player = P1.id AND R1.id = IF(P1.sexe = 1, 'wta', 'atp')
LEFT JOIN tennis_rankings R1B on R1B.player = P1B.id AND R1B.id = IF(P1B.sexe = 1, 'wta', 'atp')
LEFT JOIN tennis_rankings R2 on R2.player = P2.id AND R2.id = IF(P2.sexe = 1, 'wta', 'atp')
LEFT JOIN tennis_rankings R2B on R2B.player = P2B.id AND R2B.id = IF(P2B.sexe = 1, 'wta', 'atp')
LEFT JOIN `livescores_new`.`matchs` LS ON (LS.tt_match_id = M.id)
LEFT JOIN tournois_programmes S on S.idm = M.id
LEFT JOIN lieux_courts CT on (CT.ids = S.ids && CT.ordre = S.court)
JOIN `leagues_rounds` LR on LR.id = M.league_round
JOIN `leagues` L on L.id = LR.league
JOIN tournois_name N on N.league = L.id
LEFT JOIN lieux_sites SL on SL.id = LR.site
LEFT JOIN lieux_villes SC on SC.id = SL.idv
LEFT JOIN lieux_pays SCO on SCO.code = SC.pays
WHERE
M.id = '9432687'
&& M.type_tournoi_add = 2
&& (S.statut = 0 || S.statut = 4 || S.statut = 2 || ISNULL(S.statut))
LIMIT 1
SELECT M.*
, M.time_start time_start
, M.time time_end
, M.duration_pause
, M.type_match_add type_match
, M.type_tournoi_add type_tournament
, M.niveau level
, M.qualif
, M.idw winner_id
, P1.id p1_id
, P1.nom p1_name
, P1.prenom p1_first_name
, P1.name_zh p1_name_zh
, P1.birthday p1_birthday
, P1.sexe p1_gender
, P1.nat p1_nat
, P1.photo p1_photo
, P1.taille p1_height
, P1.poids p1_weight
, R1.rank p1_rank
, R1.liveRank p1_rank_live
, P1.pro_depuis p1_turn_pro
, '?' p1_best_rank
, P1.prise p1_forehand
, P1.revers p1_backhand
, M.ts1 p1_seed
, P1B.id p1b_id
, P1B.nom p1b_name
, P1B.prenom p1b_first_name
, P1B.name_zh p1b_name_zh
, P1B.birthday p1b_birthday
, P1B.sexe p1b_gender
, P1B.nat p1b_nat
, P1B.photo p1b_photo
, P1B.taille p1b_height
, P1B.poids p1b_weight
, R1B.rank p1b_rank
, R1B.liveRank p1b_rank_live
, P1B.pro_depuis p1b_turn_pro
, P2.id p2_id
, P2.nom p2_name
, P2.prenom p2_first_name
, P2.name_zh p2_name_zh
, P2.birthday p2_birthday
, P2.sexe p2_gender
, P2.nat p2_nat
, P2.photo p2_photo
, P2.taille p2_height
, P2.poids p2_weight
, R2.rank p2_rank
, R2.liveRank p2_rank_live
, P2.pro_depuis p2_turn_pro
, '?' p2_best_rank
, P2.prise p2_forehand
, P2.revers p2_backhand
, M.ts2 p2_seed
, P2B.id p2b_id
, P2B.nom p2b_name
, P2B.prenom p2b_first_name
, P2B.name_zh p2b_name_zh
, P2B.birthday p2b_birthday
, P2B.sexe p2b_gender
, P2B.nat p2b_nat
, P2B.photo p2b_photo
, P2B.taille p2b_height
, P2B.poids p2b_weight
, R2B.rank p2b_rank
, R2B.liveRank p2b_rank_live
, P2B.pro_depuis p2b_turn_pro
, T.id tournament_id
, T.idt tournament_idt
, '?' rencontre_id
, N.name_fr tournament_name_fr
, N.name_en tournament_name_en
, N.name_zh tournament_name_zh
, N.name_de tournament_name_de
, N.name_es tournament_name_es
, T.ville tournament_city
, T.stade tournament_stadium
, T.surface tournament_surface
, T.surface_photo tournament_surface_photo
, T.surface_color tournament_surface_color
, T.monnaie tournament_currency
, T.prix tournament_prize_money
, SCO.nom_fr tournament_country
, T.logo tournament_logo
, T.debut tournament_start
, T.fin tournament_end
, T.nbj tournament_nbPlayer
, T.genre tournament_genre
, T.category tournament_category
, T.type tournament_type
, T.ids tournament_site
, T.year tournament_year
, T.importance tournament_importance
, '' team1
, '' team2
, T.importance
, T.background tournament_background
, SC.fuseau_horaire
, IF(ISNULL(LS.status) || M.status = 2 || M.status = 3 || M.status = 4, M.status, LS.status) match_status
, LS.serve
, S.time s_time_start
, S.court
, S.date_loc
, S.type s_type
, S.ordre s_order
, C.nom court_name
, C.ordre court_order
FROM
tournois_matchs M
INNER JOIN joueurs P1 on P1.id = M.j1
LEFT OUTER JOIN `joueurs` P1B on P1B.id = M.j1_bis
INNER JOIN joueurs P2 on P2.id = M.j2
LEFT OUTER JOIN `joueurs` P2B on P2B.id = M.j2_bis
LEFT JOIN tennis_rankings R1 on R1.player = P1.id AND R1.id = IF(P1.sexe = 1, 'wta', 'atp')
LEFT JOIN tennis_rankings R1B on R1B.player = P1B.id AND R1B.id = IF(P1B.sexe = 1, 'wta', 'atp')
LEFT JOIN tennis_rankings R2 on R2.player = P2.id AND R2.id = IF(P2.sexe = 1, 'wta', 'atp')
LEFT JOIN tennis_rankings R2B on R2B.player = P2B.id AND R2B.id = IF(P2B.sexe = 1, 'wta', 'atp')
INNER JOIN tournois T on T.id = M.idt
INNER JOIN tournois_name N on N.id = T.id && N.cup = 0
LEFT OUTER JOIN lieux_sites SL on T.ids = SL.id
LEFT OUTER JOIN lieux_villes SC on SL.idv = SC.id
LEFT OUTER JOIN lieux_pays SCO on SCO.code = SC.pays
LEFT OUTER JOIN `livescores_new`.`matchs` LS on LS.tt_match_id = M.id
LEFT OUTER JOIN tournois_programmes S on S.idm = M.id
LEFT OUTER JOIN lieux_courts C on C.ids = S.ids && C.ordre = S.court
WHERE
M.id = '9432693'
&& M.type_tournoi_add = 0
&& (S.statut = 0 || S.statut = 4 || S.statut = 2 || ISNULL(S.statut))
UNION
SELECT
M.*
, M.time_start time_start
, M.time time_end
, M.duration_pause
, M.type_match_add type_match
, M.type_tournoi_add type_tournament
, CR.niveau level
, M.qualif
, M.idw winner_id
, P1.id p1_id
, P1.nom p1_name
, P1.prenom p1_first_name
, P1.name_zh p1_name_zh
, P1.birthday p1_birthday
, P1.sexe p1_gender
, P1.nat p1_nat
, P1.photo p1_photo
, P1.taille p1_height
, P1.poids p1_weight
, R1.rank p1_rank
, R1.liveRank p1_rank_live
, P1.pro_depuis p1_turn_pro
, '?' p1_best_rank
, P1.prise p1_forehand
, P1.revers p1_backhand
, M.ts1 p1_seed
, P1B.id p1b_id
, P1B.nom p1b_name
, P1B.prenom p1b_first_name
, P1B.name_zh p1b_name_zh
, P1B.birthday p1b_birthday
, P1B.sexe p1b_gender
, P1B.nat p1b_nat
, P1B.photo p1b_photo
, P1B.taille p1b_height
, P1B.poids p1b_weight
, R1B.rank p1b_rank
, R1B.liveRank p1b_rank_live
, P1B.pro_depuis p1b_turn_pro
, P2.id p2_id
, P2.nom p2_name
, P2.prenom p2_first_name
, P2.name_zh p2_name_zh
, P2.birthday p2_birthday
, P2.sexe p2_gender
, P2.nat p2_nat
, P2.photo p2_photo
, P2.taille p2_height
, P2.poids p2_weight
, R2.rank p2_rank
, R2.liveRank p2_rank_live
, P2.pro_depuis p2_turn_pro
, '?' p2_best_rank
, P2.prise p2_forehand
, P2.revers p2_backhand
, M.ts2 p2_seed
, P2B.id p2b_id
, P2B.nom p2b_name
, P2B.prenom p2b_first_name
, P2B.name_zh p2b_name_zh
, P2B.birthday p2b_birthday
, P2B.sexe p2b_gender
, P2B.nat p2b_nat
, P2B.photo p2b_photo
, P2B.taille p2b_height
, P2B.poids p2b_weight
, R2B.rank p2b_rank
, R2B.liveRank p2b_rank_live
, P2B.pro_depuis p2b_turn_pro
, C.id tournament_id
, C.parent tournament_idt
, CR.id rencontre_id
, N.name_fr tournament_name_fr
, N.name_en tournament_name_en
, N.name_zh tournament_name_zh
, N.name_de tournament_name_de
, N.name_es tournament_name_es
, CONCAT(CR.equipe_domicile, '|', CR.equipe_exterieur) tournament_city
, '' tournament_stadium
, CR.surface tournament_surface
, '' tournament_surface_photo
, '0' tournament_surface_color
, '' tournament_currency
, '' tournament_prize_money
, SCO.nom_fr tournament_country
, '' tournament_logo
, CR.date_d tournament_start
, '' tournament_end
, C.nbj tournament_nbPlayer
, '' tournament_genre
, '' tournament_category
, '' tournament_type
, CR.lieu tournament_site
, '' tournament_year
, 65 tournament_importance
, IF(T1.nom_fr, T1.nom_fr, CR.equipe_domicile) team1
, IF(T2.nom_fr, T1.nom_fr, CR.equipe_exterieur) team2
, 65 importance
, '' tournament_background
, SC.fuseau_horaire
, IF(ISNULL(LS.status) || M.status = 2 || M.status = 3 || M.status = 4, M.status, LS.status) match_status
, LS.serve
, S.time s_time_start
, S.court
, S.date_loc
, S.type s_type
, S.ordre s_order
, CT.nom court_name
, CT.ordre court_order
FROM
tournois_matchs M
INNER JOIN joueurs P1 on P1.id = M.j1
LEFT OUTER JOIN `joueurs` P1B on P1B.id = M.j1_bis
INNER JOIN joueurs P2 on P2.id = M.j2
LEFT OUTER JOIN `joueurs` P2B on P2B.id = M.j2_bis
LEFT JOIN tennis_rankings R1 on R1.player = P1.id AND R1.id = IF(P1.sexe = 1, 'wta', 'atp')
LEFT JOIN tennis_rankings R1B on R1B.player = P1B.id AND R1B.id = IF(P1B.sexe = 1, 'wta', 'atp')
LEFT JOIN tennis_rankings R2 on R2.player = P2.id AND R2.id = IF(P2.sexe = 1, 'wta', 'atp')
LEFT JOIN tennis_rankings R2B on R2B.player = P2B.id AND R2B.id = IF(P2B.sexe = 1, 'wta', 'atp')
LEFT OUTER JOIN `livescores_new`.`matchs` LS ON (LS.tt_match_id = M.id)
LEFT OUTER JOIN tournois_programmes S on S.idm = M.id
LEFT OUTER JOIN lieux_courts CT on (CT.ids = S.ids && CT.ordre = S.court)
INNER JOIN `coupes_rencontres` CR on CR.id = M.idt
INNER JOIN `coupes` C on C.id = CR.coupe_id
INNER JOIN tournois_name N on N.id = C.id
LEFT JOIN lieux_sites SL on SL.id = CR.lieu
LEFT JOIN lieux_villes SC on SC.id = SL.idv
LEFT JOIN lieux_pays SCO on SCO.code = SC.pays
LEFT JOIN `lieux_pays` T1 ON (T1.code = CR.equipe_domicile)
LEFT JOIN `lieux_pays` T2 ON (T2.code = CR.equipe_exterieur)
WHERE
M.id = '9432693'
&& M.type_tournoi_add = 1
&& (S.statut = 0 || S.statut = 4 || S.statut = 2 || ISNULL(S.statut))
UNION
SELECT
M.*
, M.time_start time_start
, M.time time_end
, M.duration_pause
, M.type_match_add type_match
, M.type_tournoi_add type_tournament
, '' level
, M.qualif
, M.idw winner_id
, P1.id p1_id
, P1.nom p1_name
, P1.prenom p1_first_name
, P1.name_zh p1_name_zh
, P1.birthday p1_birthday
, P1.sexe p1_gender
, P1.nat p1_nat
, P1.photo p1_photo
, P1.taille p1_height
, P1.poids p1_weight
, R1.rank p1_rank
, R1.liveRank p1_rank_live
, P1.pro_depuis p1_turn_pro
, '?' p1_best_rank
, P1.prise p1_forehand
, P1.revers p1_backhand
, M.ts1 p1_seed
, P1B.id p1b_id
, P1B.nom p1b_name
, P1B.prenom p1b_first_name
, P1B.name_zh p1b_name_zh
, P1B.birthday p1b_birthday
, P1B.sexe p1b_gender
, P1B.nat p1b_nat
, P1B.photo p1b_photo
, P1B.taille p1b_height
, P1B.poids p1b_weight
, R1B.rank p1b_rank
, R1B.liveRank p1b_rank_live
, P1B.pro_depuis p1b_turn_pro
, P2.id p2_id
, P2.nom p2_name
, P2.prenom p2_first_name
, P2.name_zh p2_name_zh
, P2.birthday p2_birthday
, P2.sexe p2_gender
, P2.nat p2_nat
, P2.photo p2_photo
, P2.taille p2_height
, P2.poids p2_weight
, R2.rank p2_rank
, R2.liveRank p2_rank_live
, P2.pro_depuis p2_turn_pro
, '?' p2_best_rank
, P2.prise p2_forehand
, P2.revers p2_backhand
, M.ts2 p2_seed
, P2B.id p2b_id
, P2B.nom p2b_name
, P2B.prenom p2b_first_name
, P2B.name_zh p2b_name_zh
, P2B.birthday p2b_birthday
, P2B.sexe p2b_gender
, P2B.nat p2b_nat
, P2B.photo p2b_photo
, P2B.taille p2b_height
, P2B.poids p2b_weight
, R2B.rank p2b_rank
, R2B.liveRank p2b_rank_live
, P2B.pro_depuis p2b_turn_pro
, L.id tournament_id
, 0 tournament_idt
, LR.id rencontre_id
, N.name_fr tournament_name_fr
, N.name_en tournament_name_en
, N.name_zh tournament_name_zh
, N.name_de tournament_name_de
, N.name_es tournament_name_es
, SC.nom tournament_city
, '' tournament_stadium
, '3' tournament_surface
, '' tournament_surface_photo
, '0' tournament_surface_color
, '' tournament_currency
, '' tournament_prize_money
, SCO.nom_fr tournament_country
, '' tournament_logo
, L.time_start tournament_start
, '' tournament_end
, '' tournament_nbPlayer
, '' tournament_genre
, '' tournament_category
, '' tournament_type
, LR.site tournament_site
, L.year tournament_year
, 0 tournament_importance
, '' team1
, '' team2
, 3 importance
, '' tournament_background
, SC.fuseau_horaire
, IF(ISNULL(LS.status) || M.status = 2 || M.status = 3 || M.status = 4, M.status, LS.status) match_status
, LS.serve
, S.time s_time_start
, S.court
, S.date_loc
, S.type s_type
, S.ordre s_order
, CT.nom court_name
, CT.ordre court_order
FROM
tournois_matchs M
JOIN joueurs P1 on P1.id = M.j1
LEFT JOIN `joueurs` P1B on P1B.id = M.j1_bis
JOIN joueurs P2 on P2.id = M.j2
LEFT JOIN `joueurs` P2B on P2B.id = M.j2_bis
LEFT JOIN tennis_rankings R1 on R1.player = P1.id AND R1.id = IF(P1.sexe = 1, 'wta', 'atp')
LEFT JOIN tennis_rankings R1B on R1B.player = P1B.id AND R1B.id = IF(P1B.sexe = 1, 'wta', 'atp')
LEFT JOIN tennis_rankings R2 on R2.player = P2.id AND R2.id = IF(P2.sexe = 1, 'wta', 'atp')
LEFT JOIN tennis_rankings R2B on R2B.player = P2B.id AND R2B.id = IF(P2B.sexe = 1, 'wta', 'atp')
LEFT JOIN `livescores_new`.`matchs` LS ON (LS.tt_match_id = M.id)
LEFT JOIN tournois_programmes S on S.idm = M.id
LEFT JOIN lieux_courts CT on (CT.ids = S.ids && CT.ordre = S.court)
JOIN `leagues_rounds` LR on LR.id = M.league_round
JOIN `leagues` L on L.id = LR.league
JOIN tournois_name N on N.league = L.id
LEFT JOIN lieux_sites SL on SL.id = LR.site
LEFT JOIN lieux_villes SC on SC.id = SL.idv
LEFT JOIN lieux_pays SCO on SCO.code = SC.pays
WHERE
M.id = '9432693'
&& M.type_tournoi_add = 2
&& (S.statut = 0 || S.statut = 4 || S.statut = 2 || ISNULL(S.statut))
LIMIT 1
SELECT M.*
, M.time_start time_start
, M.time time_end
, M.duration_pause
, M.type_match_add type_match
, M.type_tournoi_add type_tournament
, M.niveau level
, M.qualif
, M.idw winner_id
, P1.id p1_id
, P1.nom p1_name
, P1.prenom p1_first_name
, P1.name_zh p1_name_zh
, P1.birthday p1_birthday
, P1.sexe p1_gender
, P1.nat p1_nat
, P1.photo p1_photo
, P1.taille p1_height
, P1.poids p1_weight
, R1.rank p1_rank
, R1.liveRank p1_rank_live
, P1.pro_depuis p1_turn_pro
, '?' p1_best_rank
, P1.prise p1_forehand
, P1.revers p1_backhand
, M.ts1 p1_seed
, P1B.id p1b_id
, P1B.nom p1b_name
, P1B.prenom p1b_first_name
, P1B.name_zh p1b_name_zh
, P1B.birthday p1b_birthday
, P1B.sexe p1b_gender
, P1B.nat p1b_nat
, P1B.photo p1b_photo
, P1B.taille p1b_height
, P1B.poids p1b_weight
, R1B.rank p1b_rank
, R1B.liveRank p1b_rank_live
, P1B.pro_depuis p1b_turn_pro
, P2.id p2_id
, P2.nom p2_name
, P2.prenom p2_first_name
, P2.name_zh p2_name_zh
, P2.birthday p2_birthday
, P2.sexe p2_gender
, P2.nat p2_nat
, P2.photo p2_photo
, P2.taille p2_height
, P2.poids p2_weight
, R2.rank p2_rank
, R2.liveRank p2_rank_live
, P2.pro_depuis p2_turn_pro
, '?' p2_best_rank
, P2.prise p2_forehand
, P2.revers p2_backhand
, M.ts2 p2_seed
, P2B.id p2b_id
, P2B.nom p2b_name
, P2B.prenom p2b_first_name
, P2B.name_zh p2b_name_zh
, P2B.birthday p2b_birthday
, P2B.sexe p2b_gender
, P2B.nat p2b_nat
, P2B.photo p2b_photo
, P2B.taille p2b_height
, P2B.poids p2b_weight
, R2B.rank p2b_rank
, R2B.liveRank p2b_rank_live
, P2B.pro_depuis p2b_turn_pro
, T.id tournament_id
, T.idt tournament_idt
, '?' rencontre_id
, N.name_fr tournament_name_fr
, N.name_en tournament_name_en
, N.name_zh tournament_name_zh
, N.name_de tournament_name_de
, N.name_es tournament_name_es
, T.ville tournament_city
, T.stade tournament_stadium
, T.surface tournament_surface
, T.surface_photo tournament_surface_photo
, T.surface_color tournament_surface_color
, T.monnaie tournament_currency
, T.prix tournament_prize_money
, SCO.nom_fr tournament_country
, T.logo tournament_logo
, T.debut tournament_start
, T.fin tournament_end
, T.nbj tournament_nbPlayer
, T.genre tournament_genre
, T.category tournament_category
, T.type tournament_type
, T.ids tournament_site
, T.year tournament_year
, T.importance tournament_importance
, '' team1
, '' team2
, T.importance
, T.background tournament_background
, SC.fuseau_horaire
, IF(ISNULL(LS.status) || M.status = 2 || M.status = 3 || M.status = 4, M.status, LS.status) match_status
, LS.serve
, S.time s_time_start
, S.court
, S.date_loc
, S.type s_type
, S.ordre s_order
, C.nom court_name
, C.ordre court_order
FROM
tournois_matchs M
INNER JOIN joueurs P1 on P1.id = M.j1
LEFT OUTER JOIN `joueurs` P1B on P1B.id = M.j1_bis
INNER JOIN joueurs P2 on P2.id = M.j2
LEFT OUTER JOIN `joueurs` P2B on P2B.id = M.j2_bis
LEFT JOIN tennis_rankings R1 on R1.player = P1.id AND R1.id = IF(P1.sexe = 1, 'wta', 'atp')
LEFT JOIN tennis_rankings R1B on R1B.player = P1B.id AND R1B.id = IF(P1B.sexe = 1, 'wta', 'atp')
LEFT JOIN tennis_rankings R2 on R2.player = P2.id AND R2.id = IF(P2.sexe = 1, 'wta', 'atp')
LEFT JOIN tennis_rankings R2B on R2B.player = P2B.id AND R2B.id = IF(P2B.sexe = 1, 'wta', 'atp')
INNER JOIN tournois T on T.id = M.idt
INNER JOIN tournois_name N on N.id = T.id && N.cup = 0
LEFT OUTER JOIN lieux_sites SL on T.ids = SL.id
LEFT OUTER JOIN lieux_villes SC on SL.idv = SC.id
LEFT OUTER JOIN lieux_pays SCO on SCO.code = SC.pays
LEFT OUTER JOIN `livescores_new`.`matchs` LS on LS.tt_match_id = M.id
LEFT OUTER JOIN tournois_programmes S on S.idm = M.id
LEFT OUTER JOIN lieux_courts C on C.ids = S.ids && C.ordre = S.court
WHERE
M.id = '9432694'
&& M.type_tournoi_add = 0
&& (S.statut = 0 || S.statut = 4 || S.statut = 2 || ISNULL(S.statut))
UNION
SELECT
M.*
, M.time_start time_start
, M.time time_end
, M.duration_pause
, M.type_match_add type_match
, M.type_tournoi_add type_tournament
, CR.niveau level
, M.qualif
, M.idw winner_id
, P1.id p1_id
, P1.nom p1_name
, P1.prenom p1_first_name
, P1.name_zh p1_name_zh
, P1.birthday p1_birthday
, P1.sexe p1_gender
, P1.nat p1_nat
, P1.photo p1_photo
, P1.taille p1_height
, P1.poids p1_weight
, R1.rank p1_rank
, R1.liveRank p1_rank_live
, P1.pro_depuis p1_turn_pro
, '?' p1_best_rank
, P1.prise p1_forehand
, P1.revers p1_backhand
, M.ts1 p1_seed
, P1B.id p1b_id
, P1B.nom p1b_name
, P1B.prenom p1b_first_name
, P1B.name_zh p1b_name_zh
, P1B.birthday p1b_birthday
, P1B.sexe p1b_gender
, P1B.nat p1b_nat
, P1B.photo p1b_photo
, P1B.taille p1b_height
, P1B.poids p1b_weight
, R1B.rank p1b_rank
, R1B.liveRank p1b_rank_live
, P1B.pro_depuis p1b_turn_pro
, P2.id p2_id
, P2.nom p2_name
, P2.prenom p2_first_name
, P2.name_zh p2_name_zh
, P2.birthday p2_birthday
, P2.sexe p2_gender
, P2.nat p2_nat
, P2.photo p2_photo
, P2.taille p2_height
, P2.poids p2_weight
, R2.rank p2_rank
, R2.liveRank p2_rank_live
, P2.pro_depuis p2_turn_pro
, '?' p2_best_rank
, P2.prise p2_forehand
, P2.revers p2_backhand
, M.ts2 p2_seed
, P2B.id p2b_id
, P2B.nom p2b_name
, P2B.prenom p2b_first_name
, P2B.name_zh p2b_name_zh
, P2B.birthday p2b_birthday
, P2B.sexe p2b_gender
, P2B.nat p2b_nat
, P2B.photo p2b_photo
, P2B.taille p2b_height
, P2B.poids p2b_weight
, R2B.rank p2b_rank
, R2B.liveRank p2b_rank_live
, P2B.pro_depuis p2b_turn_pro
, C.id tournament_id
, C.parent tournament_idt
, CR.id rencontre_id
, N.name_fr tournament_name_fr
, N.name_en tournament_name_en
, N.name_zh tournament_name_zh
, N.name_de tournament_name_de
, N.name_es tournament_name_es
, CONCAT(CR.equipe_domicile, '|', CR.equipe_exterieur) tournament_city
, '' tournament_stadium
, CR.surface tournament_surface
, '' tournament_surface_photo
, '0' tournament_surface_color
, '' tournament_currency
, '' tournament_prize_money
, SCO.nom_fr tournament_country
, '' tournament_logo
, CR.date_d tournament_start
, '' tournament_end
, C.nbj tournament_nbPlayer
, '' tournament_genre
, '' tournament_category
, '' tournament_type
, CR.lieu tournament_site
, '' tournament_year
, 65 tournament_importance
, IF(T1.nom_fr, T1.nom_fr, CR.equipe_domicile) team1
, IF(T2.nom_fr, T1.nom_fr, CR.equipe_exterieur) team2
, 65 importance
, '' tournament_background
, SC.fuseau_horaire
, IF(ISNULL(LS.status) || M.status = 2 || M.status = 3 || M.status = 4, M.status, LS.status) match_status
, LS.serve
, S.time s_time_start
, S.court
, S.date_loc
, S.type s_type
, S.ordre s_order
, CT.nom court_name
, CT.ordre court_order
FROM
tournois_matchs M
INNER JOIN joueurs P1 on P1.id = M.j1
LEFT OUTER JOIN `joueurs` P1B on P1B.id = M.j1_bis
INNER JOIN joueurs P2 on P2.id = M.j2
LEFT OUTER JOIN `joueurs` P2B on P2B.id = M.j2_bis
LEFT JOIN tennis_rankings R1 on R1.player = P1.id AND R1.id = IF(P1.sexe = 1, 'wta', 'atp')
LEFT JOIN tennis_rankings R1B on R1B.player = P1B.id AND R1B.id = IF(P1B.sexe = 1, 'wta', 'atp')
LEFT JOIN tennis_rankings R2 on R2.player = P2.id AND R2.id = IF(P2.sexe = 1, 'wta', 'atp')
LEFT JOIN tennis_rankings R2B on R2B.player = P2B.id AND R2B.id = IF(P2B.sexe = 1, 'wta', 'atp')
LEFT OUTER JOIN `livescores_new`.`matchs` LS ON (LS.tt_match_id = M.id)
LEFT OUTER JOIN tournois_programmes S on S.idm = M.id
LEFT OUTER JOIN lieux_courts CT on (CT.ids = S.ids && CT.ordre = S.court)
INNER JOIN `coupes_rencontres` CR on CR.id = M.idt
INNER JOIN `coupes` C on C.id = CR.coupe_id
INNER JOIN tournois_name N on N.id = C.id
LEFT JOIN lieux_sites SL on SL.id = CR.lieu
LEFT JOIN lieux_villes SC on SC.id = SL.idv
LEFT JOIN lieux_pays SCO on SCO.code = SC.pays
LEFT JOIN `lieux_pays` T1 ON (T1.code = CR.equipe_domicile)
LEFT JOIN `lieux_pays` T2 ON (T2.code = CR.equipe_exterieur)
WHERE
M.id = '9432694'
&& M.type_tournoi_add = 1
&& (S.statut = 0 || S.statut = 4 || S.statut = 2 || ISNULL(S.statut))
UNION
SELECT
M.*
, M.time_start time_start
, M.time time_end
, M.duration_pause
, M.type_match_add type_match
, M.type_tournoi_add type_tournament
, '' level
, M.qualif
, M.idw winner_id
, P1.id p1_id
, P1.nom p1_name
, P1.prenom p1_first_name
, P1.name_zh p1_name_zh
, P1.birthday p1_birthday
, P1.sexe p1_gender
, P1.nat p1_nat
, P1.photo p1_photo
, P1.taille p1_height
, P1.poids p1_weight
, R1.rank p1_rank
, R1.liveRank p1_rank_live
, P1.pro_depuis p1_turn_pro
, '?' p1_best_rank
, P1.prise p1_forehand
, P1.revers p1_backhand
, M.ts1 p1_seed
, P1B.id p1b_id
, P1B.nom p1b_name
, P1B.prenom p1b_first_name
, P1B.name_zh p1b_name_zh
, P1B.birthday p1b_birthday
, P1B.sexe p1b_gender
, P1B.nat p1b_nat
, P1B.photo p1b_photo
, P1B.taille p1b_height
, P1B.poids p1b_weight
, R1B.rank p1b_rank
, R1B.liveRank p1b_rank_live
, P1B.pro_depuis p1b_turn_pro
, P2.id p2_id
, P2.nom p2_name
, P2.prenom p2_first_name
, P2.name_zh p2_name_zh
, P2.birthday p2_birthday
, P2.sexe p2_gender
, P2.nat p2_nat
, P2.photo p2_photo
, P2.taille p2_height
, P2.poids p2_weight
, R2.rank p2_rank
, R2.liveRank p2_rank_live
, P2.pro_depuis p2_turn_pro
, '?' p2_best_rank
, P2.prise p2_forehand
, P2.revers p2_backhand
, M.ts2 p2_seed
, P2B.id p2b_id
, P2B.nom p2b_name
, P2B.prenom p2b_first_name
, P2B.name_zh p2b_name_zh
, P2B.birthday p2b_birthday
, P2B.sexe p2b_gender
, P2B.nat p2b_nat
, P2B.photo p2b_photo
, P2B.taille p2b_height
, P2B.poids p2b_weight
, R2B.rank p2b_rank
, R2B.liveRank p2b_rank_live
, P2B.pro_depuis p2b_turn_pro
, L.id tournament_id
, 0 tournament_idt
, LR.id rencontre_id
, N.name_fr tournament_name_fr
, N.name_en tournament_name_en
, N.name_zh tournament_name_zh
, N.name_de tournament_name_de
, N.name_es tournament_name_es
, SC.nom tournament_city
, '' tournament_stadium
, '3' tournament_surface
, '' tournament_surface_photo
, '0' tournament_surface_color
, '' tournament_currency
, '' tournament_prize_money
, SCO.nom_fr tournament_country
, '' tournament_logo
, L.time_start tournament_start
, '' tournament_end
, '' tournament_nbPlayer
, '' tournament_genre
, '' tournament_category
, '' tournament_type
, LR.site tournament_site
, L.year tournament_year
, 0 tournament_importance
, '' team1
, '' team2
, 3 importance
, '' tournament_background
, SC.fuseau_horaire
, IF(ISNULL(LS.status) || M.status = 2 || M.status = 3 || M.status = 4, M.status, LS.status) match_status
, LS.serve
, S.time s_time_start
, S.court
, S.date_loc
, S.type s_type
, S.ordre s_order
, CT.nom court_name
, CT.ordre court_order
FROM
tournois_matchs M
JOIN joueurs P1 on P1.id = M.j1
LEFT JOIN `joueurs` P1B on P1B.id = M.j1_bis
JOIN joueurs P2 on P2.id = M.j2
LEFT JOIN `joueurs` P2B on P2B.id = M.j2_bis
LEFT JOIN tennis_rankings R1 on R1.player = P1.id AND R1.id = IF(P1.sexe = 1, 'wta', 'atp')
LEFT JOIN tennis_rankings R1B on R1B.player = P1B.id AND R1B.id = IF(P1B.sexe = 1, 'wta', 'atp')
LEFT JOIN tennis_rankings R2 on R2.player = P2.id AND R2.id = IF(P2.sexe = 1, 'wta', 'atp')
LEFT JOIN tennis_rankings R2B on R2B.player = P2B.id AND R2B.id = IF(P2B.sexe = 1, 'wta', 'atp')
LEFT JOIN `livescores_new`.`matchs` LS ON (LS.tt_match_id = M.id)
LEFT JOIN tournois_programmes S on S.idm = M.id
LEFT JOIN lieux_courts CT on (CT.ids = S.ids && CT.ordre = S.court)
JOIN `leagues_rounds` LR on LR.id = M.league_round
JOIN `leagues` L on L.id = LR.league
JOIN tournois_name N on N.league = L.id
LEFT JOIN lieux_sites SL on SL.id = LR.site
LEFT JOIN lieux_villes SC on SC.id = SL.idv
LEFT JOIN lieux_pays SCO on SCO.code = SC.pays
WHERE
M.id = '9432694'
&& M.type_tournoi_add = 2
&& (S.statut = 0 || S.statut = 4 || S.statut = 2 || ISNULL(S.statut))
LIMIT 1
SELECT M.*
, M.time_start time_start
, M.time time_end
, M.duration_pause
, M.type_match_add type_match
, M.type_tournoi_add type_tournament
, M.niveau level
, M.qualif
, M.idw winner_id
, P1.id p1_id
, P1.nom p1_name
, P1.prenom p1_first_name
, P1.name_zh p1_name_zh
, P1.birthday p1_birthday
, P1.sexe p1_gender
, P1.nat p1_nat
, P1.photo p1_photo
, P1.taille p1_height
, P1.poids p1_weight
, R1.rank p1_rank
, R1.liveRank p1_rank_live
, P1.pro_depuis p1_turn_pro
, '?' p1_best_rank
, P1.prise p1_forehand
, P1.revers p1_backhand
, M.ts1 p1_seed
, P1B.id p1b_id
, P1B.nom p1b_name
, P1B.prenom p1b_first_name
, P1B.name_zh p1b_name_zh
, P1B.birthday p1b_birthday
, P1B.sexe p1b_gender
, P1B.nat p1b_nat
, P1B.photo p1b_photo
, P1B.taille p1b_height
, P1B.poids p1b_weight
, R1B.rank p1b_rank
, R1B.liveRank p1b_rank_live
, P1B.pro_depuis p1b_turn_pro
, P2.id p2_id
, P2.nom p2_name
, P2.prenom p2_first_name
, P2.name_zh p2_name_zh
, P2.birthday p2_birthday
, P2.sexe p2_gender
, P2.nat p2_nat
, P2.photo p2_photo
, P2.taille p2_height
, P2.poids p2_weight
, R2.rank p2_rank
, R2.liveRank p2_rank_live
, P2.pro_depuis p2_turn_pro
, '?' p2_best_rank
, P2.prise p2_forehand
, P2.revers p2_backhand
, M.ts2 p2_seed
, P2B.id p2b_id
, P2B.nom p2b_name
, P2B.prenom p2b_first_name
, P2B.name_zh p2b_name_zh
, P2B.birthday p2b_birthday
, P2B.sexe p2b_gender
, P2B.nat p2b_nat
, P2B.photo p2b_photo
, P2B.taille p2b_height
, P2B.poids p2b_weight
, R2B.rank p2b_rank
, R2B.liveRank p2b_rank_live
, P2B.pro_depuis p2b_turn_pro
, T.id tournament_id
, T.idt tournament_idt
, '?' rencontre_id
, N.name_fr tournament_name_fr
, N.name_en tournament_name_en
, N.name_zh tournament_name_zh
, N.name_de tournament_name_de
, N.name_es tournament_name_es
, T.ville tournament_city
, T.stade tournament_stadium
, T.surface tournament_surface
, T.surface_photo tournament_surface_photo
, T.surface_color tournament_surface_color
, T.monnaie tournament_currency
, T.prix tournament_prize_money
, SCO.nom_fr tournament_country
, T.logo tournament_logo
, T.debut tournament_start
, T.fin tournament_end
, T.nbj tournament_nbPlayer
, T.genre tournament_genre
, T.category tournament_category
, T.type tournament_type
, T.ids tournament_site
, T.year tournament_year
, T.importance tournament_importance
, '' team1
, '' team2
, T.importance
, T.background tournament_background
, SC.fuseau_horaire
, IF(ISNULL(LS.status) || M.status = 2 || M.status = 3 || M.status = 4, M.status, LS.status) match_status
, LS.serve
, S.time s_time_start
, S.court
, S.date_loc
, S.type s_type
, S.ordre s_order
, C.nom court_name
, C.ordre court_order
FROM
tournois_matchs M
INNER JOIN joueurs P1 on P1.id = M.j1
LEFT OUTER JOIN `joueurs` P1B on P1B.id = M.j1_bis
INNER JOIN joueurs P2 on P2.id = M.j2
LEFT OUTER JOIN `joueurs` P2B on P2B.id = M.j2_bis
LEFT JOIN tennis_rankings R1 on R1.player = P1.id AND R1.id = IF(P1.sexe = 1, 'wta', 'atp')
LEFT JOIN tennis_rankings R1B on R1B.player = P1B.id AND R1B.id = IF(P1B.sexe = 1, 'wta', 'atp')
LEFT JOIN tennis_rankings R2 on R2.player = P2.id AND R2.id = IF(P2.sexe = 1, 'wta', 'atp')
LEFT JOIN tennis_rankings R2B on R2B.player = P2B.id AND R2B.id = IF(P2B.sexe = 1, 'wta', 'atp')
INNER JOIN tournois T on T.id = M.idt
INNER JOIN tournois_name N on N.id = T.id && N.cup = 0
LEFT OUTER JOIN lieux_sites SL on T.ids = SL.id
LEFT OUTER JOIN lieux_villes SC on SL.idv = SC.id
LEFT OUTER JOIN lieux_pays SCO on SCO.code = SC.pays
LEFT OUTER JOIN `livescores_new`.`matchs` LS on LS.tt_match_id = M.id
LEFT OUTER JOIN tournois_programmes S on S.idm = M.id
LEFT OUTER JOIN lieux_courts C on C.ids = S.ids && C.ordre = S.court
WHERE
M.id = '9432700'
&& M.type_tournoi_add = 0
&& (S.statut = 0 || S.statut = 4 || S.statut = 2 || ISNULL(S.statut))
UNION
SELECT
M.*
, M.time_start time_start
, M.time time_end
, M.duration_pause
, M.type_match_add type_match
, M.type_tournoi_add type_tournament
, CR.niveau level
, M.qualif
, M.idw winner_id
, P1.id p1_id
, P1.nom p1_name
, P1.prenom p1_first_name
, P1.name_zh p1_name_zh
, P1.birthday p1_birthday
, P1.sexe p1_gender
, P1.nat p1_nat
, P1.photo p1_photo
, P1.taille p1_height
, P1.poids p1_weight
, R1.rank p1_rank
, R1.liveRank p1_rank_live
, P1.pro_depuis p1_turn_pro
, '?' p1_best_rank
, P1.prise p1_forehand
, P1.revers p1_backhand
, M.ts1 p1_seed
, P1B.id p1b_id
, P1B.nom p1b_name
, P1B.prenom p1b_first_name
, P1B.name_zh p1b_name_zh
, P1B.birthday p1b_birthday
, P1B.sexe p1b_gender
, P1B.nat p1b_nat
, P1B.photo p1b_photo
, P1B.taille p1b_height
, P1B.poids p1b_weight
, R1B.rank p1b_rank
, R1B.liveRank p1b_rank_live
, P1B.pro_depuis p1b_turn_pro
, P2.id p2_id
, P2.nom p2_name
, P2.prenom p2_first_name
, P2.name_zh p2_name_zh
, P2.birthday p2_birthday
, P2.sexe p2_gender
, P2.nat p2_nat
, P2.photo p2_photo
, P2.taille p2_height
, P2.poids p2_weight
, R2.rank p2_rank
, R2.liveRank p2_rank_live
, P2.pro_depuis p2_turn_pro
, '?' p2_best_rank
, P2.prise p2_forehand
, P2.revers p2_backhand
, M.ts2 p2_seed
, P2B.id p2b_id
, P2B.nom p2b_name
, P2B.prenom p2b_first_name
, P2B.name_zh p2b_name_zh
, P2B.birthday p2b_birthday
, P2B.sexe p2b_gender
, P2B.nat p2b_nat
, P2B.photo p2b_photo
, P2B.taille p2b_height
, P2B.poids p2b_weight
, R2B.rank p2b_rank
, R2B.liveRank p2b_rank_live
, P2B.pro_depuis p2b_turn_pro
, C.id tournament_id
, C.parent tournament_idt
, CR.id rencontre_id
, N.name_fr tournament_name_fr
, N.name_en tournament_name_en
, N.name_zh tournament_name_zh
, N.name_de tournament_name_de
, N.name_es tournament_name_es
, CONCAT(CR.equipe_domicile, '|', CR.equipe_exterieur) tournament_city
, '' tournament_stadium
, CR.surface tournament_surface
, '' tournament_surface_photo
, '0' tournament_surface_color
, '' tournament_currency
, '' tournament_prize_money
, SCO.nom_fr tournament_country
, '' tournament_logo
, CR.date_d tournament_start
, '' tournament_end
, C.nbj tournament_nbPlayer
, '' tournament_genre
, '' tournament_category
, '' tournament_type
, CR.lieu tournament_site
, '' tournament_year
, 65 tournament_importance
, IF(T1.nom_fr, T1.nom_fr, CR.equipe_domicile) team1
, IF(T2.nom_fr, T1.nom_fr, CR.equipe_exterieur) team2
, 65 importance
, '' tournament_background
, SC.fuseau_horaire
, IF(ISNULL(LS.status) || M.status = 2 || M.status = 3 || M.status = 4, M.status, LS.status) match_status
, LS.serve
, S.time s_time_start
, S.court
, S.date_loc
, S.type s_type
, S.ordre s_order
, CT.nom court_name
, CT.ordre court_order
FROM
tournois_matchs M
INNER JOIN joueurs P1 on P1.id = M.j1
LEFT OUTER JOIN `joueurs` P1B on P1B.id = M.j1_bis
INNER JOIN joueurs P2 on P2.id = M.j2
LEFT OUTER JOIN `joueurs` P2B on P2B.id = M.j2_bis
LEFT JOIN tennis_rankings R1 on R1.player = P1.id AND R1.id = IF(P1.sexe = 1, 'wta', 'atp')
LEFT JOIN tennis_rankings R1B on R1B.player = P1B.id AND R1B.id = IF(P1B.sexe = 1, 'wta', 'atp')
LEFT JOIN tennis_rankings R2 on R2.player = P2.id AND R2.id = IF(P2.sexe = 1, 'wta', 'atp')
LEFT JOIN tennis_rankings R2B on R2B.player = P2B.id AND R2B.id = IF(P2B.sexe = 1, 'wta', 'atp')
LEFT OUTER JOIN `livescores_new`.`matchs` LS ON (LS.tt_match_id = M.id)
LEFT OUTER JOIN tournois_programmes S on S.idm = M.id
LEFT OUTER JOIN lieux_courts CT on (CT.ids = S.ids && CT.ordre = S.court)
INNER JOIN `coupes_rencontres` CR on CR.id = M.idt
INNER JOIN `coupes` C on C.id = CR.coupe_id
INNER JOIN tournois_name N on N.id = C.id
LEFT JOIN lieux_sites SL on SL.id = CR.lieu
LEFT JOIN lieux_villes SC on SC.id = SL.idv
LEFT JOIN lieux_pays SCO on SCO.code = SC.pays
LEFT JOIN `lieux_pays` T1 ON (T1.code = CR.equipe_domicile)
LEFT JOIN `lieux_pays` T2 ON (T2.code = CR.equipe_exterieur)
WHERE
M.id = '9432700'
&& M.type_tournoi_add = 1
&& (S.statut = 0 || S.statut = 4 || S.statut = 2 || ISNULL(S.statut))
UNION
SELECT
M.*
, M.time_start time_start
, M.time time_end
, M.duration_pause
, M.type_match_add type_match
, M.type_tournoi_add type_tournament
, '' level
, M.qualif
, M.idw winner_id
, P1.id p1_id
, P1.nom p1_name
, P1.prenom p1_first_name
, P1.name_zh p1_name_zh
, P1.birthday p1_birthday
, P1.sexe p1_gender
, P1.nat p1_nat
, P1.photo p1_photo
, P1.taille p1_height
, P1.poids p1_weight
, R1.rank p1_rank
, R1.liveRank p1_rank_live
, P1.pro_depuis p1_turn_pro
, '?' p1_best_rank
, P1.prise p1_forehand
, P1.revers p1_backhand
, M.ts1 p1_seed
, P1B.id p1b_id
, P1B.nom p1b_name
, P1B.prenom p1b_first_name
, P1B.name_zh p1b_name_zh
, P1B.birthday p1b_birthday
, P1B.sexe p1b_gender
, P1B.nat p1b_nat
, P1B.photo p1b_photo
, P1B.taille p1b_height
, P1B.poids p1b_weight
, R1B.rank p1b_rank
, R1B.liveRank p1b_rank_live
, P1B.pro_depuis p1b_turn_pro
, P2.id p2_id
, P2.nom p2_name
, P2.prenom p2_first_name
, P2.name_zh p2_name_zh
, P2.birthday p2_birthday
, P2.sexe p2_gender
, P2.nat p2_nat
, P2.photo p2_photo
, P2.taille p2_height
, P2.poids p2_weight
, R2.rank p2_rank
, R2.liveRank p2_rank_live
, P2.pro_depuis p2_turn_pro
, '?' p2_best_rank
, P2.prise p2_forehand
, P2.revers p2_backhand
, M.ts2 p2_seed
, P2B.id p2b_id
, P2B.nom p2b_name
, P2B.prenom p2b_first_name
, P2B.name_zh p2b_name_zh
, P2B.birthday p2b_birthday
, P2B.sexe p2b_gender
, P2B.nat p2b_nat
, P2B.photo p2b_photo
, P2B.taille p2b_height
, P2B.poids p2b_weight
, R2B.rank p2b_rank
, R2B.liveRank p2b_rank_live
, P2B.pro_depuis p2b_turn_pro
, L.id tournament_id
, 0 tournament_idt
, LR.id rencontre_id
, N.name_fr tournament_name_fr
, N.name_en tournament_name_en
, N.name_zh tournament_name_zh
, N.name_de tournament_name_de
, N.name_es tournament_name_es
, SC.nom tournament_city
, '' tournament_stadium
, '3' tournament_surface
, '' tournament_surface_photo
, '0' tournament_surface_color
, '' tournament_currency
, '' tournament_prize_money
, SCO.nom_fr tournament_country
, '' tournament_logo
, L.time_start tournament_start
, '' tournament_end
, '' tournament_nbPlayer
, '' tournament_genre
, '' tournament_category
, '' tournament_type
, LR.site tournament_site
, L.year tournament_year
, 0 tournament_importance
, '' team1
, '' team2
, 3 importance
, '' tournament_background
, SC.fuseau_horaire
, IF(ISNULL(LS.status) || M.status = 2 || M.status = 3 || M.status = 4, M.status, LS.status) match_status
, LS.serve
, S.time s_time_start
, S.court
, S.date_loc
, S.type s_type
, S.ordre s_order
, CT.nom court_name
, CT.ordre court_order
FROM
tournois_matchs M
JOIN joueurs P1 on P1.id = M.j1
LEFT JOIN `joueurs` P1B on P1B.id = M.j1_bis
JOIN joueurs P2 on P2.id = M.j2
LEFT JOIN `joueurs` P2B on P2B.id = M.j2_bis
LEFT JOIN tennis_rankings R1 on R1.player = P1.id AND R1.id = IF(P1.sexe = 1, 'wta', 'atp')
LEFT JOIN tennis_rankings R1B on R1B.player = P1B.id AND R1B.id = IF(P1B.sexe = 1, 'wta', 'atp')
LEFT JOIN tennis_rankings R2 on R2.player = P2.id AND R2.id = IF(P2.sexe = 1, 'wta', 'atp')
LEFT JOIN tennis_rankings R2B on R2B.player = P2B.id AND R2B.id = IF(P2B.sexe = 1, 'wta', 'atp')
LEFT JOIN `livescores_new`.`matchs` LS ON (LS.tt_match_id = M.id)
LEFT JOIN tournois_programmes S on S.idm = M.id
LEFT JOIN lieux_courts CT on (CT.ids = S.ids && CT.ordre = S.court)
JOIN `leagues_rounds` LR on LR.id = M.league_round
JOIN `leagues` L on L.id = LR.league
JOIN tournois_name N on N.league = L.id
LEFT JOIN lieux_sites SL on SL.id = LR.site
LEFT JOIN lieux_villes SC on SC.id = SL.idv
LEFT JOIN lieux_pays SCO on SCO.code = SC.pays
WHERE
M.id = '9432700'
&& M.type_tournoi_add = 2
&& (S.statut = 0 || S.statut = 4 || S.statut = 2 || ISNULL(S.statut))
LIMIT 1
SELECT M.*
, M.time_start time_start
, M.time time_end
, M.duration_pause
, M.type_match_add type_match
, M.type_tournoi_add type_tournament
, M.niveau level
, M.qualif
, M.idw winner_id
, P1.id p1_id
, P1.nom p1_name
, P1.prenom p1_first_name
, P1.name_zh p1_name_zh
, P1.birthday p1_birthday
, P1.sexe p1_gender
, P1.nat p1_nat
, P1.photo p1_photo
, P1.taille p1_height
, P1.poids p1_weight
, R1.rank p1_rank
, R1.liveRank p1_rank_live
, P1.pro_depuis p1_turn_pro
, '?' p1_best_rank
, P1.prise p1_forehand
, P1.revers p1_backhand
, M.ts1 p1_seed
, P1B.id p1b_id
, P1B.nom p1b_name
, P1B.prenom p1b_first_name
, P1B.name_zh p1b_name_zh
, P1B.birthday p1b_birthday
, P1B.sexe p1b_gender
, P1B.nat p1b_nat
, P1B.photo p1b_photo
, P1B.taille p1b_height
, P1B.poids p1b_weight
, R1B.rank p1b_rank
, R1B.liveRank p1b_rank_live
, P1B.pro_depuis p1b_turn_pro
, P2.id p2_id
, P2.nom p2_name
, P2.prenom p2_first_name
, P2.name_zh p2_name_zh
, P2.birthday p2_birthday
, P2.sexe p2_gender
, P2.nat p2_nat
, P2.photo p2_photo
, P2.taille p2_height
, P2.poids p2_weight
, R2.rank p2_rank
, R2.liveRank p2_rank_live
, P2.pro_depuis p2_turn_pro
, '?' p2_best_rank
, P2.prise p2_forehand
, P2.revers p2_backhand
, M.ts2 p2_seed
, P2B.id p2b_id
, P2B.nom p2b_name
, P2B.prenom p2b_first_name
, P2B.name_zh p2b_name_zh
, P2B.birthday p2b_birthday
, P2B.sexe p2b_gender
, P2B.nat p2b_nat
, P2B.photo p2b_photo
, P2B.taille p2b_height
, P2B.poids p2b_weight
, R2B.rank p2b_rank
, R2B.liveRank p2b_rank_live
, P2B.pro_depuis p2b_turn_pro
, T.id tournament_id
, T.idt tournament_idt
, '?' rencontre_id
, N.name_fr tournament_name_fr
, N.name_en tournament_name_en
, N.name_zh tournament_name_zh
, N.name_de tournament_name_de
, N.name_es tournament_name_es
, T.ville tournament_city
, T.stade tournament_stadium
, T.surface tournament_surface
, T.surface_photo tournament_surface_photo
, T.surface_color tournament_surface_color
, T.monnaie tournament_currency
, T.prix tournament_prize_money
, SCO.nom_fr tournament_country
, T.logo tournament_logo
, T.debut tournament_start
, T.fin tournament_end
, T.nbj tournament_nbPlayer
, T.genre tournament_genre
, T.category tournament_category
, T.type tournament_type
, T.ids tournament_site
, T.year tournament_year
, T.importance tournament_importance
, '' team1
, '' team2
, T.importance
, T.background tournament_background
, SC.fuseau_horaire
, IF(ISNULL(LS.status) || M.status = 2 || M.status = 3 || M.status = 4, M.status, LS.status) match_status
, LS.serve
, S.time s_time_start
, S.court
, S.date_loc
, S.type s_type
, S.ordre s_order
, C.nom court_name
, C.ordre court_order
FROM
tournois_matchs M
INNER JOIN joueurs P1 on P1.id = M.j1
LEFT OUTER JOIN `joueurs` P1B on P1B.id = M.j1_bis
INNER JOIN joueurs P2 on P2.id = M.j2
LEFT OUTER JOIN `joueurs` P2B on P2B.id = M.j2_bis
LEFT JOIN tennis_rankings R1 on R1.player = P1.id AND R1.id = IF(P1.sexe = 1, 'wta', 'atp')
LEFT JOIN tennis_rankings R1B on R1B.player = P1B.id AND R1B.id = IF(P1B.sexe = 1, 'wta', 'atp')
LEFT JOIN tennis_rankings R2 on R2.player = P2.id AND R2.id = IF(P2.sexe = 1, 'wta', 'atp')
LEFT JOIN tennis_rankings R2B on R2B.player = P2B.id AND R2B.id = IF(P2B.sexe = 1, 'wta', 'atp')
INNER JOIN tournois T on T.id = M.idt
INNER JOIN tournois_name N on N.id = T.id && N.cup = 0
LEFT OUTER JOIN lieux_sites SL on T.ids = SL.id
LEFT OUTER JOIN lieux_villes SC on SL.idv = SC.id
LEFT OUTER JOIN lieux_pays SCO on SCO.code = SC.pays
LEFT OUTER JOIN `livescores_new`.`matchs` LS on LS.tt_match_id = M.id
LEFT OUTER JOIN tournois_programmes S on S.idm = M.id
LEFT OUTER JOIN lieux_courts C on C.ids = S.ids && C.ordre = S.court
WHERE
M.id = '9432705'
&& M.type_tournoi_add = 0
&& (S.statut = 0 || S.statut = 4 || S.statut = 2 || ISNULL(S.statut))
UNION
SELECT
M.*
, M.time_start time_start
, M.time time_end
, M.duration_pause
, M.type_match_add type_match
, M.type_tournoi_add type_tournament
, CR.niveau level
, M.qualif
, M.idw winner_id
, P1.id p1_id
, P1.nom p1_name
, P1.prenom p1_first_name
, P1.name_zh p1_name_zh
, P1.birthday p1_birthday
, P1.sexe p1_gender
, P1.nat p1_nat
, P1.photo p1_photo
, P1.taille p1_height
, P1.poids p1_weight
, R1.rank p1_rank
, R1.liveRank p1_rank_live
, P1.pro_depuis p1_turn_pro
, '?' p1_best_rank
, P1.prise p1_forehand
, P1.revers p1_backhand
, M.ts1 p1_seed
, P1B.id p1b_id
, P1B.nom p1b_name
, P1B.prenom p1b_first_name
, P1B.name_zh p1b_name_zh
, P1B.birthday p1b_birthday
, P1B.sexe p1b_gender
, P1B.nat p1b_nat
, P1B.photo p1b_photo
, P1B.taille p1b_height
, P1B.poids p1b_weight
, R1B.rank p1b_rank
, R1B.liveRank p1b_rank_live
, P1B.pro_depuis p1b_turn_pro
, P2.id p2_id
, P2.nom p2_name
, P2.prenom p2_first_name
, P2.name_zh p2_name_zh
, P2.birthday p2_birthday
, P2.sexe p2_gender
, P2.nat p2_nat
, P2.photo p2_photo
, P2.taille p2_height
, P2.poids p2_weight
, R2.rank p2_rank
, R2.liveRank p2_rank_live
, P2.pro_depuis p2_turn_pro
, '?' p2_best_rank
, P2.prise p2_forehand
, P2.revers p2_backhand
, M.ts2 p2_seed
, P2B.id p2b_id
, P2B.nom p2b_name
, P2B.prenom p2b_first_name
, P2B.name_zh p2b_name_zh
, P2B.birthday p2b_birthday
, P2B.sexe p2b_gender
, P2B.nat p2b_nat
, P2B.photo p2b_photo
, P2B.taille p2b_height
, P2B.poids p2b_weight
, R2B.rank p2b_rank
, R2B.liveRank p2b_rank_live
, P2B.pro_depuis p2b_turn_pro
, C.id tournament_id
, C.parent tournament_idt
, CR.id rencontre_id
, N.name_fr tournament_name_fr
, N.name_en tournament_name_en
, N.name_zh tournament_name_zh
, N.name_de tournament_name_de
, N.name_es tournament_name_es
, CONCAT(CR.equipe_domicile, '|', CR.equipe_exterieur) tournament_city
, '' tournament_stadium
, CR.surface tournament_surface
, '' tournament_surface_photo
, '0' tournament_surface_color
, '' tournament_currency
, '' tournament_prize_money
, SCO.nom_fr tournament_country
, '' tournament_logo
, CR.date_d tournament_start
, '' tournament_end
, C.nbj tournament_nbPlayer
, '' tournament_genre
, '' tournament_category
, '' tournament_type
, CR.lieu tournament_site
, '' tournament_year
, 65 tournament_importance
, IF(T1.nom_fr, T1.nom_fr, CR.equipe_domicile) team1
, IF(T2.nom_fr, T1.nom_fr, CR.equipe_exterieur) team2
, 65 importance
, '' tournament_background
, SC.fuseau_horaire
, IF(ISNULL(LS.status) || M.status = 2 || M.status = 3 || M.status = 4, M.status, LS.status) match_status
, LS.serve
, S.time s_time_start
, S.court
, S.date_loc
, S.type s_type
, S.ordre s_order
, CT.nom court_name
, CT.ordre court_order
FROM
tournois_matchs M
INNER JOIN joueurs P1 on P1.id = M.j1
LEFT OUTER JOIN `joueurs` P1B on P1B.id = M.j1_bis
INNER JOIN joueurs P2 on P2.id = M.j2
LEFT OUTER JOIN `joueurs` P2B on P2B.id = M.j2_bis
LEFT JOIN tennis_rankings R1 on R1.player = P1.id AND R1.id = IF(P1.sexe = 1, 'wta', 'atp')
LEFT JOIN tennis_rankings R1B on R1B.player = P1B.id AND R1B.id = IF(P1B.sexe = 1, 'wta', 'atp')
LEFT JOIN tennis_rankings R2 on R2.player = P2.id AND R2.id = IF(P2.sexe = 1, 'wta', 'atp')
LEFT JOIN tennis_rankings R2B on R2B.player = P2B.id AND R2B.id = IF(P2B.sexe = 1, 'wta', 'atp')
LEFT OUTER JOIN `livescores_new`.`matchs` LS ON (LS.tt_match_id = M.id)
LEFT OUTER JOIN tournois_programmes S on S.idm = M.id
LEFT OUTER JOIN lieux_courts CT on (CT.ids = S.ids && CT.ordre = S.court)
INNER JOIN `coupes_rencontres` CR on CR.id = M.idt
INNER JOIN `coupes` C on C.id = CR.coupe_id
INNER JOIN tournois_name N on N.id = C.id
LEFT JOIN lieux_sites SL on SL.id = CR.lieu
LEFT JOIN lieux_villes SC on SC.id = SL.idv
LEFT JOIN lieux_pays SCO on SCO.code = SC.pays
LEFT JOIN `lieux_pays` T1 ON (T1.code = CR.equipe_domicile)
LEFT JOIN `lieux_pays` T2 ON (T2.code = CR.equipe_exterieur)
WHERE
M.id = '9432705'
&& M.type_tournoi_add = 1
&& (S.statut = 0 || S.statut = 4 || S.statut = 2 || ISNULL(S.statut))
UNION
SELECT
M.*
, M.time_start time_start
, M.time time_end
, M.duration_pause
, M.type_match_add type_match
, M.type_tournoi_add type_tournament
, '' level
, M.qualif
, M.idw winner_id
, P1.id p1_id
, P1.nom p1_name
, P1.prenom p1_first_name
, P1.name_zh p1_name_zh
, P1.birthday p1_birthday
, P1.sexe p1_gender
, P1.nat p1_nat
, P1.photo p1_photo
, P1.taille p1_height
, P1.poids p1_weight
, R1.rank p1_rank
, R1.liveRank p1_rank_live
, P1.pro_depuis p1_turn_pro
, '?' p1_best_rank
, P1.prise p1_forehand
, P1.revers p1_backhand
, M.ts1 p1_seed
, P1B.id p1b_id
, P1B.nom p1b_name
, P1B.prenom p1b_first_name
, P1B.name_zh p1b_name_zh
, P1B.birthday p1b_birthday
, P1B.sexe p1b_gender
, P1B.nat p1b_nat
, P1B.photo p1b_photo
, P1B.taille p1b_height
, P1B.poids p1b_weight
, R1B.rank p1b_rank
, R1B.liveRank p1b_rank_live
, P1B.pro_depuis p1b_turn_pro
, P2.id p2_id
, P2.nom p2_name
, P2.prenom p2_first_name
, P2.name_zh p2_name_zh
, P2.birthday p2_birthday
, P2.sexe p2_gender
, P2.nat p2_nat
, P2.photo p2_photo
, P2.taille p2_height
, P2.poids p2_weight
, R2.rank p2_rank
, R2.liveRank p2_rank_live
, P2.pro_depuis p2_turn_pro
, '?' p2_best_rank
, P2.prise p2_forehand
, P2.revers p2_backhand
, M.ts2 p2_seed
, P2B.id p2b_id
, P2B.nom p2b_name
, P2B.prenom p2b_first_name
, P2B.name_zh p2b_name_zh
, P2B.birthday p2b_birthday
, P2B.sexe p2b_gender
, P2B.nat p2b_nat
, P2B.photo p2b_photo
, P2B.taille p2b_height
, P2B.poids p2b_weight
, R2B.rank p2b_rank
, R2B.liveRank p2b_rank_live
, P2B.pro_depuis p2b_turn_pro
, L.id tournament_id
, 0 tournament_idt
, LR.id rencontre_id
, N.name_fr tournament_name_fr
, N.name_en tournament_name_en
, N.name_zh tournament_name_zh
, N.name_de tournament_name_de
, N.name_es tournament_name_es
, SC.nom tournament_city
, '' tournament_stadium
, '3' tournament_surface
, '' tournament_surface_photo
, '0' tournament_surface_color
, '' tournament_currency
, '' tournament_prize_money
, SCO.nom_fr tournament_country
, '' tournament_logo
, L.time_start tournament_start
, '' tournament_end
, '' tournament_nbPlayer
, '' tournament_genre
, '' tournament_category
, '' tournament_type
, LR.site tournament_site
, L.year tournament_year
, 0 tournament_importance
, '' team1
, '' team2
, 3 importance
, '' tournament_background
, SC.fuseau_horaire
, IF(ISNULL(LS.status) || M.status = 2 || M.status = 3 || M.status = 4, M.status, LS.status) match_status
, LS.serve
, S.time s_time_start
, S.court
, S.date_loc
, S.type s_type
, S.ordre s_order
, CT.nom court_name
, CT.ordre court_order
FROM
tournois_matchs M
JOIN joueurs P1 on P1.id = M.j1
LEFT JOIN `joueurs` P1B on P1B.id = M.j1_bis
JOIN joueurs P2 on P2.id = M.j2
LEFT JOIN `joueurs` P2B on P2B.id = M.j2_bis
LEFT JOIN tennis_rankings R1 on R1.player = P1.id AND R1.id = IF(P1.sexe = 1, 'wta', 'atp')
LEFT JOIN tennis_rankings R1B on R1B.player = P1B.id AND R1B.id = IF(P1B.sexe = 1, 'wta', 'atp')
LEFT JOIN tennis_rankings R2 on R2.player = P2.id AND R2.id = IF(P2.sexe = 1, 'wta', 'atp')
LEFT JOIN tennis_rankings R2B on R2B.player = P2B.id AND R2B.id = IF(P2B.sexe = 1, 'wta', 'atp')
LEFT JOIN `livescores_new`.`matchs` LS ON (LS.tt_match_id = M.id)
LEFT JOIN tournois_programmes S on S.idm = M.id
LEFT JOIN lieux_courts CT on (CT.ids = S.ids && CT.ordre = S.court)
JOIN `leagues_rounds` LR on LR.id = M.league_round
JOIN `leagues` L on L.id = LR.league
JOIN tournois_name N on N.league = L.id
LEFT JOIN lieux_sites SL on SL.id = LR.site
LEFT JOIN lieux_villes SC on SC.id = SL.idv
LEFT JOIN lieux_pays SCO on SCO.code = SC.pays
WHERE
M.id = '9432705'
&& M.type_tournoi_add = 2
&& (S.statut = 0 || S.statut = 4 || S.statut = 2 || ISNULL(S.statut))
LIMIT 1
SELECT M.*
, M.time_start time_start
, M.time time_end
, M.duration_pause
, M.type_match_add type_match
, M.type_tournoi_add type_tournament
, M.niveau level
, M.qualif
, M.idw winner_id
, P1.id p1_id
, P1.nom p1_name
, P1.prenom p1_first_name
, P1.name_zh p1_name_zh
, P1.birthday p1_birthday
, P1.sexe p1_gender
, P1.nat p1_nat
, P1.photo p1_photo
, P1.taille p1_height
, P1.poids p1_weight
, R1.rank p1_rank
, R1.liveRank p1_rank_live
, P1.pro_depuis p1_turn_pro
, '?' p1_best_rank
, P1.prise p1_forehand
, P1.revers p1_backhand
, M.ts1 p1_seed
, P1B.id p1b_id
, P1B.nom p1b_name
, P1B.prenom p1b_first_name
, P1B.name_zh p1b_name_zh
, P1B.birthday p1b_birthday
, P1B.sexe p1b_gender
, P1B.nat p1b_nat
, P1B.photo p1b_photo
, P1B.taille p1b_height
, P1B.poids p1b_weight
, R1B.rank p1b_rank
, R1B.liveRank p1b_rank_live
, P1B.pro_depuis p1b_turn_pro
, P2.id p2_id
, P2.nom p2_name
, P2.prenom p2_first_name
, P2.name_zh p2_name_zh
, P2.birthday p2_birthday
, P2.sexe p2_gender
, P2.nat p2_nat
, P2.photo p2_photo
, P2.taille p2_height
, P2.poids p2_weight
, R2.rank p2_rank
, R2.liveRank p2_rank_live
, P2.pro_depuis p2_turn_pro
, '?' p2_best_rank
, P2.prise p2_forehand
, P2.revers p2_backhand
, M.ts2 p2_seed
, P2B.id p2b_id
, P2B.nom p2b_name
, P2B.prenom p2b_first_name
, P2B.name_zh p2b_name_zh
, P2B.birthday p2b_birthday
, P2B.sexe p2b_gender
, P2B.nat p2b_nat
, P2B.photo p2b_photo
, P2B.taille p2b_height
, P2B.poids p2b_weight
, R2B.rank p2b_rank
, R2B.liveRank p2b_rank_live
, P2B.pro_depuis p2b_turn_pro
, T.id tournament_id
, T.idt tournament_idt
, '?' rencontre_id
, N.name_fr tournament_name_fr
, N.name_en tournament_name_en
, N.name_zh tournament_name_zh
, N.name_de tournament_name_de
, N.name_es tournament_name_es
, T.ville tournament_city
, T.stade tournament_stadium
, T.surface tournament_surface
, T.surface_photo tournament_surface_photo
, T.surface_color tournament_surface_color
, T.monnaie tournament_currency
, T.prix tournament_prize_money
, SCO.nom_fr tournament_country
, T.logo tournament_logo
, T.debut tournament_start
, T.fin tournament_end
, T.nbj tournament_nbPlayer
, T.genre tournament_genre
, T.category tournament_category
, T.type tournament_type
, T.ids tournament_site
, T.year tournament_year
, T.importance tournament_importance
, '' team1
, '' team2
, T.importance
, T.background tournament_background
, SC.fuseau_horaire
, IF(ISNULL(LS.status) || M.status = 2 || M.status = 3 || M.status = 4, M.status, LS.status) match_status
, LS.serve
, S.time s_time_start
, S.court
, S.date_loc
, S.type s_type
, S.ordre s_order
, C.nom court_name
, C.ordre court_order
FROM
tournois_matchs M
INNER JOIN joueurs P1 on P1.id = M.j1
LEFT OUTER JOIN `joueurs` P1B on P1B.id = M.j1_bis
INNER JOIN joueurs P2 on P2.id = M.j2
LEFT OUTER JOIN `joueurs` P2B on P2B.id = M.j2_bis
LEFT JOIN tennis_rankings R1 on R1.player = P1.id AND R1.id = IF(P1.sexe = 1, 'wta', 'atp')
LEFT JOIN tennis_rankings R1B on R1B.player = P1B.id AND R1B.id = IF(P1B.sexe = 1, 'wta', 'atp')
LEFT JOIN tennis_rankings R2 on R2.player = P2.id AND R2.id = IF(P2.sexe = 1, 'wta', 'atp')
LEFT JOIN tennis_rankings R2B on R2B.player = P2B.id AND R2B.id = IF(P2B.sexe = 1, 'wta', 'atp')
INNER JOIN tournois T on T.id = M.idt
INNER JOIN tournois_name N on N.id = T.id && N.cup = 0
LEFT OUTER JOIN lieux_sites SL on T.ids = SL.id
LEFT OUTER JOIN lieux_villes SC on SL.idv = SC.id
LEFT OUTER JOIN lieux_pays SCO on SCO.code = SC.pays
LEFT OUTER JOIN `livescores_new`.`matchs` LS on LS.tt_match_id = M.id
LEFT OUTER JOIN tournois_programmes S on S.idm = M.id
LEFT OUTER JOIN lieux_courts C on C.ids = S.ids && C.ordre = S.court
WHERE
M.id = '9432711'
&& M.type_tournoi_add = 0
&& (S.statut = 0 || S.statut = 4 || S.statut = 2 || ISNULL(S.statut))
UNION
SELECT
M.*
, M.time_start time_start
, M.time time_end
, M.duration_pause
, M.type_match_add type_match
, M.type_tournoi_add type_tournament
, CR.niveau level
, M.qualif
, M.idw winner_id
, P1.id p1_id
, P1.nom p1_name
, P1.prenom p1_first_name
, P1.name_zh p1_name_zh
, P1.birthday p1_birthday
, P1.sexe p1_gender
, P1.nat p1_nat
, P1.photo p1_photo
, P1.taille p1_height
, P1.poids p1_weight
, R1.rank p1_rank
, R1.liveRank p1_rank_live
, P1.pro_depuis p1_turn_pro
, '?' p1_best_rank
, P1.prise p1_forehand
, P1.revers p1_backhand
, M.ts1 p1_seed
, P1B.id p1b_id
, P1B.nom p1b_name
, P1B.prenom p1b_first_name
, P1B.name_zh p1b_name_zh
, P1B.birthday p1b_birthday
, P1B.sexe p1b_gender
, P1B.nat p1b_nat
, P1B.photo p1b_photo
, P1B.taille p1b_height
, P1B.poids p1b_weight
, R1B.rank p1b_rank
, R1B.liveRank p1b_rank_live
, P1B.pro_depuis p1b_turn_pro
, P2.id p2_id
, P2.nom p2_name
, P2.prenom p2_first_name
, P2.name_zh p2_name_zh
, P2.birthday p2_birthday
, P2.sexe p2_gender
, P2.nat p2_nat
, P2.photo p2_photo
, P2.taille p2_height
, P2.poids p2_weight
, R2.rank p2_rank
, R2.liveRank p2_rank_live
, P2.pro_depuis p2_turn_pro
, '?' p2_best_rank
, P2.prise p2_forehand
, P2.revers p2_backhand
, M.ts2 p2_seed
, P2B.id p2b_id
, P2B.nom p2b_name
, P2B.prenom p2b_first_name
, P2B.name_zh p2b_name_zh
, P2B.birthday p2b_birthday
, P2B.sexe p2b_gender
, P2B.nat p2b_nat
, P2B.photo p2b_photo
, P2B.taille p2b_height
, P2B.poids p2b_weight
, R2B.rank p2b_rank
, R2B.liveRank p2b_rank_live
, P2B.pro_depuis p2b_turn_pro
, C.id tournament_id
, C.parent tournament_idt
, CR.id rencontre_id
, N.name_fr tournament_name_fr
, N.name_en tournament_name_en
, N.name_zh tournament_name_zh
, N.name_de tournament_name_de
, N.name_es tournament_name_es
, CONCAT(CR.equipe_domicile, '|', CR.equipe_exterieur) tournament_city
, '' tournament_stadium
, CR.surface tournament_surface
, '' tournament_surface_photo
, '0' tournament_surface_color
, '' tournament_currency
, '' tournament_prize_money
, SCO.nom_fr tournament_country
, '' tournament_logo
, CR.date_d tournament_start
, '' tournament_end
, C.nbj tournament_nbPlayer
, '' tournament_genre
, '' tournament_category
, '' tournament_type
, CR.lieu tournament_site
, '' tournament_year
, 65 tournament_importance
, IF(T1.nom_fr, T1.nom_fr, CR.equipe_domicile) team1
, IF(T2.nom_fr, T1.nom_fr, CR.equipe_exterieur) team2
, 65 importance
, '' tournament_background
, SC.fuseau_horaire
, IF(ISNULL(LS.status) || M.status = 2 || M.status = 3 || M.status = 4, M.status, LS.status) match_status
, LS.serve
, S.time s_time_start
, S.court
, S.date_loc
, S.type s_type
, S.ordre s_order
, CT.nom court_name
, CT.ordre court_order
FROM
tournois_matchs M
INNER JOIN joueurs P1 on P1.id = M.j1
LEFT OUTER JOIN `joueurs` P1B on P1B.id = M.j1_bis
INNER JOIN joueurs P2 on P2.id = M.j2
LEFT OUTER JOIN `joueurs` P2B on P2B.id = M.j2_bis
LEFT JOIN tennis_rankings R1 on R1.player = P1.id AND R1.id = IF(P1.sexe = 1, 'wta', 'atp')
LEFT JOIN tennis_rankings R1B on R1B.player = P1B.id AND R1B.id = IF(P1B.sexe = 1, 'wta', 'atp')
LEFT JOIN tennis_rankings R2 on R2.player = P2.id AND R2.id = IF(P2.sexe = 1, 'wta', 'atp')
LEFT JOIN tennis_rankings R2B on R2B.player = P2B.id AND R2B.id = IF(P2B.sexe = 1, 'wta', 'atp')
LEFT OUTER JOIN `livescores_new`.`matchs` LS ON (LS.tt_match_id = M.id)
LEFT OUTER JOIN tournois_programmes S on S.idm = M.id
LEFT OUTER JOIN lieux_courts CT on (CT.ids = S.ids && CT.ordre = S.court)
INNER JOIN `coupes_rencontres` CR on CR.id = M.idt
INNER JOIN `coupes` C on C.id = CR.coupe_id
INNER JOIN tournois_name N on N.id = C.id
LEFT JOIN lieux_sites SL on SL.id = CR.lieu
LEFT JOIN lieux_villes SC on SC.id = SL.idv
LEFT JOIN lieux_pays SCO on SCO.code = SC.pays
LEFT JOIN `lieux_pays` T1 ON (T1.code = CR.equipe_domicile)
LEFT JOIN `lieux_pays` T2 ON (T2.code = CR.equipe_exterieur)
WHERE
M.id = '9432711'
&& M.type_tournoi_add = 1
&& (S.statut = 0 || S.statut = 4 || S.statut = 2 || ISNULL(S.statut))
UNION
SELECT
M.*
, M.time_start time_start
, M.time time_end
, M.duration_pause
, M.type_match_add type_match
, M.type_tournoi_add type_tournament
, '' level
, M.qualif
, M.idw winner_id
, P1.id p1_id
, P1.nom p1_name
, P1.prenom p1_first_name
, P1.name_zh p1_name_zh
, P1.birthday p1_birthday
, P1.sexe p1_gender
, P1.nat p1_nat
, P1.photo p1_photo
, P1.taille p1_height
, P1.poids p1_weight
, R1.rank p1_rank
, R1.liveRank p1_rank_live
, P1.pro_depuis p1_turn_pro
, '?' p1_best_rank
, P1.prise p1_forehand
, P1.revers p1_backhand
, M.ts1 p1_seed
, P1B.id p1b_id
, P1B.nom p1b_name
, P1B.prenom p1b_first_name
, P1B.name_zh p1b_name_zh
, P1B.birthday p1b_birthday
, P1B.sexe p1b_gender
, P1B.nat p1b_nat
, P1B.photo p1b_photo
, P1B.taille p1b_height
, P1B.poids p1b_weight
, R1B.rank p1b_rank
, R1B.liveRank p1b_rank_live
, P1B.pro_depuis p1b_turn_pro
, P2.id p2_id
, P2.nom p2_name
, P2.prenom p2_first_name
, P2.name_zh p2_name_zh
, P2.birthday p2_birthday
, P2.sexe p2_gender
, P2.nat p2_nat
, P2.photo p2_photo
, P2.taille p2_height
, P2.poids p2_weight
, R2.rank p2_rank
, R2.liveRank p2_rank_live
, P2.pro_depuis p2_turn_pro
, '?' p2_best_rank
, P2.prise p2_forehand
, P2.revers p2_backhand
, M.ts2 p2_seed
, P2B.id p2b_id
, P2B.nom p2b_name
, P2B.prenom p2b_first_name
, P2B.name_zh p2b_name_zh
, P2B.birthday p2b_birthday
, P2B.sexe p2b_gender
, P2B.nat p2b_nat
, P2B.photo p2b_photo
, P2B.taille p2b_height
, P2B.poids p2b_weight
, R2B.rank p2b_rank
, R2B.liveRank p2b_rank_live
, P2B.pro_depuis p2b_turn_pro
, L.id tournament_id
, 0 tournament_idt
, LR.id rencontre_id
, N.name_fr tournament_name_fr
, N.name_en tournament_name_en
, N.name_zh tournament_name_zh
, N.name_de tournament_name_de
, N.name_es tournament_name_es
, SC.nom tournament_city
, '' tournament_stadium
, '3' tournament_surface
, '' tournament_surface_photo
, '0' tournament_surface_color
, '' tournament_currency
, '' tournament_prize_money
, SCO.nom_fr tournament_country
, '' tournament_logo
, L.time_start tournament_start
, '' tournament_end
, '' tournament_nbPlayer
, '' tournament_genre
, '' tournament_category
, '' tournament_type
, LR.site tournament_site
, L.year tournament_year
, 0 tournament_importance
, '' team1
, '' team2
, 3 importance
, '' tournament_background
, SC.fuseau_horaire
, IF(ISNULL(LS.status) || M.status = 2 || M.status = 3 || M.status = 4, M.status, LS.status) match_status
, LS.serve
, S.time s_time_start
, S.court
, S.date_loc
, S.type s_type
, S.ordre s_order
, CT.nom court_name
, CT.ordre court_order
FROM
tournois_matchs M
JOIN joueurs P1 on P1.id = M.j1
LEFT JOIN `joueurs` P1B on P1B.id = M.j1_bis
JOIN joueurs P2 on P2.id = M.j2
LEFT JOIN `joueurs` P2B on P2B.id = M.j2_bis
LEFT JOIN tennis_rankings R1 on R1.player = P1.id AND R1.id = IF(P1.sexe = 1, 'wta', 'atp')
LEFT JOIN tennis_rankings R1B on R1B.player = P1B.id AND R1B.id = IF(P1B.sexe = 1, 'wta', 'atp')
LEFT JOIN tennis_rankings R2 on R2.player = P2.id AND R2.id = IF(P2.sexe = 1, 'wta', 'atp')
LEFT JOIN tennis_rankings R2B on R2B.player = P2B.id AND R2B.id = IF(P2B.sexe = 1, 'wta', 'atp')
LEFT JOIN `livescores_new`.`matchs` LS ON (LS.tt_match_id = M.id)
LEFT JOIN tournois_programmes S on S.idm = M.id
LEFT JOIN lieux_courts CT on (CT.ids = S.ids && CT.ordre = S.court)
JOIN `leagues_rounds` LR on LR.id = M.league_round
JOIN `leagues` L on L.id = LR.league
JOIN tournois_name N on N.league = L.id
LEFT JOIN lieux_sites SL on SL.id = LR.site
LEFT JOIN lieux_villes SC on SC.id = SL.idv
LEFT JOIN lieux_pays SCO on SCO.code = SC.pays
WHERE
M.id = '9432711'
&& M.type_tournoi_add = 2
&& (S.statut = 0 || S.statut = 4 || S.statut = 2 || ISNULL(S.statut))
LIMIT 1
SELECT M.*
, M.time_start time_start
, M.time time_end
, M.duration_pause
, M.type_match_add type_match
, M.type_tournoi_add type_tournament
, M.niveau level
, M.qualif
, M.idw winner_id
, P1.id p1_id
, P1.nom p1_name
, P1.prenom p1_first_name
, P1.name_zh p1_name_zh
, P1.birthday p1_birthday
, P1.sexe p1_gender
, P1.nat p1_nat
, P1.photo p1_photo
, P1.taille p1_height
, P1.poids p1_weight
, R1.rank p1_rank
, R1.liveRank p1_rank_live
, P1.pro_depuis p1_turn_pro
, '?' p1_best_rank
, P1.prise p1_forehand
, P1.revers p1_backhand
, M.ts1 p1_seed
, P1B.id p1b_id
, P1B.nom p1b_name
, P1B.prenom p1b_first_name
, P1B.name_zh p1b_name_zh
, P1B.birthday p1b_birthday
, P1B.sexe p1b_gender
, P1B.nat p1b_nat
, P1B.photo p1b_photo
, P1B.taille p1b_height
, P1B.poids p1b_weight
, R1B.rank p1b_rank
, R1B.liveRank p1b_rank_live
, P1B.pro_depuis p1b_turn_pro
, P2.id p2_id
, P2.nom p2_name
, P2.prenom p2_first_name
, P2.name_zh p2_name_zh
, P2.birthday p2_birthday
, P2.sexe p2_gender
, P2.nat p2_nat
, P2.photo p2_photo
, P2.taille p2_height
, P2.poids p2_weight
, R2.rank p2_rank
, R2.liveRank p2_rank_live
, P2.pro_depuis p2_turn_pro
, '?' p2_best_rank
, P2.prise p2_forehand
, P2.revers p2_backhand
, M.ts2 p2_seed
, P2B.id p2b_id
, P2B.nom p2b_name
, P2B.prenom p2b_first_name
, P2B.name_zh p2b_name_zh
, P2B.birthday p2b_birthday
, P2B.sexe p2b_gender
, P2B.nat p2b_nat
, P2B.photo p2b_photo
, P2B.taille p2b_height
, P2B.poids p2b_weight
, R2B.rank p2b_rank
, R2B.liveRank p2b_rank_live
, P2B.pro_depuis p2b_turn_pro
, T.id tournament_id
, T.idt tournament_idt
, '?' rencontre_id
, N.name_fr tournament_name_fr
, N.name_en tournament_name_en
, N.name_zh tournament_name_zh
, N.name_de tournament_name_de
, N.name_es tournament_name_es
, T.ville tournament_city
, T.stade tournament_stadium
, T.surface tournament_surface
, T.surface_photo tournament_surface_photo
, T.surface_color tournament_surface_color
, T.monnaie tournament_currency
, T.prix tournament_prize_money
, SCO.nom_fr tournament_country
, T.logo tournament_logo
, T.debut tournament_start
, T.fin tournament_end
, T.nbj tournament_nbPlayer
, T.genre tournament_genre
, T.category tournament_category
, T.type tournament_type
, T.ids tournament_site
, T.year tournament_year
, T.importance tournament_importance
, '' team1
, '' team2
, T.importance
, T.background tournament_background
, SC.fuseau_horaire
, IF(ISNULL(LS.status) || M.status = 2 || M.status = 3 || M.status = 4, M.status, LS.status) match_status
, LS.serve
, S.time s_time_start
, S.court
, S.date_loc
, S.type s_type
, S.ordre s_order
, C.nom court_name
, C.ordre court_order
FROM
tournois_matchs M
INNER JOIN joueurs P1 on P1.id = M.j1
LEFT OUTER JOIN `joueurs` P1B on P1B.id = M.j1_bis
INNER JOIN joueurs P2 on P2.id = M.j2
LEFT OUTER JOIN `joueurs` P2B on P2B.id = M.j2_bis
LEFT JOIN tennis_rankings R1 on R1.player = P1.id AND R1.id = IF(P1.sexe = 1, 'wta', 'atp')
LEFT JOIN tennis_rankings R1B on R1B.player = P1B.id AND R1B.id = IF(P1B.sexe = 1, 'wta', 'atp')
LEFT JOIN tennis_rankings R2 on R2.player = P2.id AND R2.id = IF(P2.sexe = 1, 'wta', 'atp')
LEFT JOIN tennis_rankings R2B on R2B.player = P2B.id AND R2B.id = IF(P2B.sexe = 1, 'wta', 'atp')
INNER JOIN tournois T on T.id = M.idt
INNER JOIN tournois_name N on N.id = T.id && N.cup = 0
LEFT OUTER JOIN lieux_sites SL on T.ids = SL.id
LEFT OUTER JOIN lieux_villes SC on SL.idv = SC.id
LEFT OUTER JOIN lieux_pays SCO on SCO.code = SC.pays
LEFT OUTER JOIN `livescores_new`.`matchs` LS on LS.tt_match_id = M.id
LEFT OUTER JOIN tournois_programmes S on S.idm = M.id
LEFT OUTER JOIN lieux_courts C on C.ids = S.ids && C.ordre = S.court
WHERE
M.id = '9432712'
&& M.type_tournoi_add = 0
&& (S.statut = 0 || S.statut = 4 || S.statut = 2 || ISNULL(S.statut))
UNION
SELECT
M.*
, M.time_start time_start
, M.time time_end
, M.duration_pause
, M.type_match_add type_match
, M.type_tournoi_add type_tournament
, CR.niveau level
, M.qualif
, M.idw winner_id
, P1.id p1_id
, P1.nom p1_name
, P1.prenom p1_first_name
, P1.name_zh p1_name_zh
, P1.birthday p1_birthday
, P1.sexe p1_gender
, P1.nat p1_nat
, P1.photo p1_photo
, P1.taille p1_height
, P1.poids p1_weight
, R1.rank p1_rank
, R1.liveRank p1_rank_live
, P1.pro_depuis p1_turn_pro
, '?' p1_best_rank
, P1.prise p1_forehand
, P1.revers p1_backhand
, M.ts1 p1_seed
, P1B.id p1b_id
, P1B.nom p1b_name
, P1B.prenom p1b_first_name
, P1B.name_zh p1b_name_zh
, P1B.birthday p1b_birthday
, P1B.sexe p1b_gender
, P1B.nat p1b_nat
, P1B.photo p1b_photo
, P1B.taille p1b_height
, P1B.poids p1b_weight
, R1B.rank p1b_rank
, R1B.liveRank p1b_rank_live
, P1B.pro_depuis p1b_turn_pro
, P2.id p2_id
, P2.nom p2_name
, P2.prenom p2_first_name
, P2.name_zh p2_name_zh
, P2.birthday p2_birthday
, P2.sexe p2_gender
, P2.nat p2_nat
, P2.photo p2_photo
, P2.taille p2_height
, P2.poids p2_weight
, R2.rank p2_rank
, R2.liveRank p2_rank_live
, P2.pro_depuis p2_turn_pro
, '?' p2_best_rank
, P2.prise p2_forehand
, P2.revers p2_backhand
, M.ts2 p2_seed
, P2B.id p2b_id
, P2B.nom p2b_name
, P2B.prenom p2b_first_name
, P2B.name_zh p2b_name_zh
, P2B.birthday p2b_birthday
, P2B.sexe p2b_gender
, P2B.nat p2b_nat
, P2B.photo p2b_photo
, P2B.taille p2b_height
, P2B.poids p2b_weight
, R2B.rank p2b_rank
, R2B.liveRank p2b_rank_live
, P2B.pro_depuis p2b_turn_pro
, C.id tournament_id
, C.parent tournament_idt
, CR.id rencontre_id
, N.name_fr tournament_name_fr
, N.name_en tournament_name_en
, N.name_zh tournament_name_zh
, N.name_de tournament_name_de
, N.name_es tournament_name_es
, CONCAT(CR.equipe_domicile, '|', CR.equipe_exterieur) tournament_city
, '' tournament_stadium
, CR.surface tournament_surface
, '' tournament_surface_photo
, '0' tournament_surface_color
, '' tournament_currency
, '' tournament_prize_money
, SCO.nom_fr tournament_country
, '' tournament_logo
, CR.date_d tournament_start
, '' tournament_end
, C.nbj tournament_nbPlayer
, '' tournament_genre
, '' tournament_category
, '' tournament_type
, CR.lieu tournament_site
, '' tournament_year
, 65 tournament_importance
, IF(T1.nom_fr, T1.nom_fr, CR.equipe_domicile) team1
, IF(T2.nom_fr, T1.nom_fr, CR.equipe_exterieur) team2
, 65 importance
, '' tournament_background
, SC.fuseau_horaire
, IF(ISNULL(LS.status) || M.status = 2 || M.status = 3 || M.status = 4, M.status, LS.status) match_status
, LS.serve
, S.time s_time_start
, S.court
, S.date_loc
, S.type s_type
, S.ordre s_order
, CT.nom court_name
, CT.ordre court_order
FROM
tournois_matchs M
INNER JOIN joueurs P1 on P1.id = M.j1
LEFT OUTER JOIN `joueurs` P1B on P1B.id = M.j1_bis
INNER JOIN joueurs P2 on P2.id = M.j2
LEFT OUTER JOIN `joueurs` P2B on P2B.id = M.j2_bis
LEFT JOIN tennis_rankings R1 on R1.player = P1.id AND R1.id = IF(P1.sexe = 1, 'wta', 'atp')
LEFT JOIN tennis_rankings R1B on R1B.player = P1B.id AND R1B.id = IF(P1B.sexe = 1, 'wta', 'atp')
LEFT JOIN tennis_rankings R2 on R2.player = P2.id AND R2.id = IF(P2.sexe = 1, 'wta', 'atp')
LEFT JOIN tennis_rankings R2B on R2B.player = P2B.id AND R2B.id = IF(P2B.sexe = 1, 'wta', 'atp')
LEFT OUTER JOIN `livescores_new`.`matchs` LS ON (LS.tt_match_id = M.id)
LEFT OUTER JOIN tournois_programmes S on S.idm = M.id
LEFT OUTER JOIN lieux_courts CT on (CT.ids = S.ids && CT.ordre = S.court)
INNER JOIN `coupes_rencontres` CR on CR.id = M.idt
INNER JOIN `coupes` C on C.id = CR.coupe_id
INNER JOIN tournois_name N on N.id = C.id
LEFT JOIN lieux_sites SL on SL.id = CR.lieu
LEFT JOIN lieux_villes SC on SC.id = SL.idv
LEFT JOIN lieux_pays SCO on SCO.code = SC.pays
LEFT JOIN `lieux_pays` T1 ON (T1.code = CR.equipe_domicile)
LEFT JOIN `lieux_pays` T2 ON (T2.code = CR.equipe_exterieur)
WHERE
M.id = '9432712'
&& M.type_tournoi_add = 1
&& (S.statut = 0 || S.statut = 4 || S.statut = 2 || ISNULL(S.statut))
UNION
SELECT
M.*
, M.time_start time_start
, M.time time_end
, M.duration_pause
, M.type_match_add type_match
, M.type_tournoi_add type_tournament
, '' level
, M.qualif
, M.idw winner_id
, P1.id p1_id
, P1.nom p1_name
, P1.prenom p1_first_name
, P1.name_zh p1_name_zh
, P1.birthday p1_birthday
, P1.sexe p1_gender
, P1.nat p1_nat
, P1.photo p1_photo
, P1.taille p1_height
, P1.poids p1_weight
, R1.rank p1_rank
, R1.liveRank p1_rank_live
, P1.pro_depuis p1_turn_pro
, '?' p1_best_rank
, P1.prise p1_forehand
, P1.revers p1_backhand
, M.ts1 p1_seed
, P1B.id p1b_id
, P1B.nom p1b_name
, P1B.prenom p1b_first_name
, P1B.name_zh p1b_name_zh
, P1B.birthday p1b_birthday
, P1B.sexe p1b_gender
, P1B.nat p1b_nat
, P1B.photo p1b_photo
, P1B.taille p1b_height
, P1B.poids p1b_weight
, R1B.rank p1b_rank
, R1B.liveRank p1b_rank_live
, P1B.pro_depuis p1b_turn_pro
, P2.id p2_id
, P2.nom p2_name
, P2.prenom p2_first_name
, P2.name_zh p2_name_zh
, P2.birthday p2_birthday
, P2.sexe p2_gender
, P2.nat p2_nat
, P2.photo p2_photo
, P2.taille p2_height
, P2.poids p2_weight
, R2.rank p2_rank
, R2.liveRank p2_rank_live
, P2.pro_depuis p2_turn_pro
, '?' p2_best_rank
, P2.prise p2_forehand
, P2.revers p2_backhand
, M.ts2 p2_seed
, P2B.id p2b_id
, P2B.nom p2b_name
, P2B.prenom p2b_first_name
, P2B.name_zh p2b_name_zh
, P2B.birthday p2b_birthday
, P2B.sexe p2b_gender
, P2B.nat p2b_nat
, P2B.photo p2b_photo
, P2B.taille p2b_height
, P2B.poids p2b_weight
, R2B.rank p2b_rank
, R2B.liveRank p2b_rank_live
, P2B.pro_depuis p2b_turn_pro
, L.id tournament_id
, 0 tournament_idt
, LR.id rencontre_id
, N.name_fr tournament_name_fr
, N.name_en tournament_name_en
, N.name_zh tournament_name_zh
, N.name_de tournament_name_de
, N.name_es tournament_name_es
, SC.nom tournament_city
, '' tournament_stadium
, '3' tournament_surface
, '' tournament_surface_photo
, '0' tournament_surface_color
, '' tournament_currency
, '' tournament_prize_money
, SCO.nom_fr tournament_country
, '' tournament_logo
, L.time_start tournament_start
, '' tournament_end
, '' tournament_nbPlayer
, '' tournament_genre
, '' tournament_category
, '' tournament_type
, LR.site tournament_site
, L.year tournament_year
, 0 tournament_importance
, '' team1
, '' team2
, 3 importance
, '' tournament_background
, SC.fuseau_horaire
, IF(ISNULL(LS.status) || M.status = 2 || M.status = 3 || M.status = 4, M.status, LS.status) match_status
, LS.serve
, S.time s_time_start
, S.court
, S.date_loc
, S.type s_type
, S.ordre s_order
, CT.nom court_name
, CT.ordre court_order
FROM
tournois_matchs M
JOIN joueurs P1 on P1.id = M.j1
LEFT JOIN `joueurs` P1B on P1B.id = M.j1_bis
JOIN joueurs P2 on P2.id = M.j2
LEFT JOIN `joueurs` P2B on P2B.id = M.j2_bis
LEFT JOIN tennis_rankings R1 on R1.player = P1.id AND R1.id = IF(P1.sexe = 1, 'wta', 'atp')
LEFT JOIN tennis_rankings R1B on R1B.player = P1B.id AND R1B.id = IF(P1B.sexe = 1, 'wta', 'atp')
LEFT JOIN tennis_rankings R2 on R2.player = P2.id AND R2.id = IF(P2.sexe = 1, 'wta', 'atp')
LEFT JOIN tennis_rankings R2B on R2B.player = P2B.id AND R2B.id = IF(P2B.sexe = 1, 'wta', 'atp')
LEFT JOIN `livescores_new`.`matchs` LS ON (LS.tt_match_id = M.id)
LEFT JOIN tournois_programmes S on S.idm = M.id
LEFT JOIN lieux_courts CT on (CT.ids = S.ids && CT.ordre = S.court)
JOIN `leagues_rounds` LR on LR.id = M.league_round
JOIN `leagues` L on L.id = LR.league
JOIN tournois_name N on N.league = L.id
LEFT JOIN lieux_sites SL on SL.id = LR.site
LEFT JOIN lieux_villes SC on SC.id = SL.idv
LEFT JOIN lieux_pays SCO on SCO.code = SC.pays
WHERE
M.id = '9432712'
&& M.type_tournoi_add = 2
&& (S.statut = 0 || S.statut = 4 || S.statut = 2 || ISNULL(S.statut))
LIMIT 1
SELECT M.*
, M.time_start time_start
, M.time time_end
, M.duration_pause
, M.type_match_add type_match
, M.type_tournoi_add type_tournament
, M.niveau level
, M.qualif
, M.idw winner_id
, P1.id p1_id
, P1.nom p1_name
, P1.prenom p1_first_name
, P1.name_zh p1_name_zh
, P1.birthday p1_birthday
, P1.sexe p1_gender
, P1.nat p1_nat
, P1.photo p1_photo
, P1.taille p1_height
, P1.poids p1_weight
, R1.rank p1_rank
, R1.liveRank p1_rank_live
, P1.pro_depuis p1_turn_pro
, '?' p1_best_rank
, P1.prise p1_forehand
, P1.revers p1_backhand
, M.ts1 p1_seed
, P1B.id p1b_id
, P1B.nom p1b_name
, P1B.prenom p1b_first_name
, P1B.name_zh p1b_name_zh
, P1B.birthday p1b_birthday
, P1B.sexe p1b_gender
, P1B.nat p1b_nat
, P1B.photo p1b_photo
, P1B.taille p1b_height
, P1B.poids p1b_weight
, R1B.rank p1b_rank
, R1B.liveRank p1b_rank_live
, P1B.pro_depuis p1b_turn_pro
, P2.id p2_id
, P2.nom p2_name
, P2.prenom p2_first_name
, P2.name_zh p2_name_zh
, P2.birthday p2_birthday
, P2.sexe p2_gender
, P2.nat p2_nat
, P2.photo p2_photo
, P2.taille p2_height
, P2.poids p2_weight
, R2.rank p2_rank
, R2.liveRank p2_rank_live
, P2.pro_depuis p2_turn_pro
, '?' p2_best_rank
, P2.prise p2_forehand
, P2.revers p2_backhand
, M.ts2 p2_seed
, P2B.id p2b_id
, P2B.nom p2b_name
, P2B.prenom p2b_first_name
, P2B.name_zh p2b_name_zh
, P2B.birthday p2b_birthday
, P2B.sexe p2b_gender
, P2B.nat p2b_nat
, P2B.photo p2b_photo
, P2B.taille p2b_height
, P2B.poids p2b_weight
, R2B.rank p2b_rank
, R2B.liveRank p2b_rank_live
, P2B.pro_depuis p2b_turn_pro
, T.id tournament_id
, T.idt tournament_idt
, '?' rencontre_id
, N.name_fr tournament_name_fr
, N.name_en tournament_name_en
, N.name_zh tournament_name_zh
, N.name_de tournament_name_de
, N.name_es tournament_name_es
, T.ville tournament_city
, T.stade tournament_stadium
, T.surface tournament_surface
, T.surface_photo tournament_surface_photo
, T.surface_color tournament_surface_color
, T.monnaie tournament_currency
, T.prix tournament_prize_money
, SCO.nom_fr tournament_country
, T.logo tournament_logo
, T.debut tournament_start
, T.fin tournament_end
, T.nbj tournament_nbPlayer
, T.genre tournament_genre
, T.category tournament_category
, T.type tournament_type
, T.ids tournament_site
, T.year tournament_year
, T.importance tournament_importance
, '' team1
, '' team2
, T.importance
, T.background tournament_background
, SC.fuseau_horaire
, IF(ISNULL(LS.status) || M.status = 2 || M.status = 3 || M.status = 4, M.status, LS.status) match_status
, LS.serve
, S.time s_time_start
, S.court
, S.date_loc
, S.type s_type
, S.ordre s_order
, C.nom court_name
, C.ordre court_order
FROM
tournois_matchs M
INNER JOIN joueurs P1 on P1.id = M.j1
LEFT OUTER JOIN `joueurs` P1B on P1B.id = M.j1_bis
INNER JOIN joueurs P2 on P2.id = M.j2
LEFT OUTER JOIN `joueurs` P2B on P2B.id = M.j2_bis
LEFT JOIN tennis_rankings R1 on R1.player = P1.id AND R1.id = IF(P1.sexe = 1, 'wta', 'atp')
LEFT JOIN tennis_rankings R1B on R1B.player = P1B.id AND R1B.id = IF(P1B.sexe = 1, 'wta', 'atp')
LEFT JOIN tennis_rankings R2 on R2.player = P2.id AND R2.id = IF(P2.sexe = 1, 'wta', 'atp')
LEFT JOIN tennis_rankings R2B on R2B.player = P2B.id AND R2B.id = IF(P2B.sexe = 1, 'wta', 'atp')
INNER JOIN tournois T on T.id = M.idt
INNER JOIN tournois_name N on N.id = T.id && N.cup = 0
LEFT OUTER JOIN lieux_sites SL on T.ids = SL.id
LEFT OUTER JOIN lieux_villes SC on SL.idv = SC.id
LEFT OUTER JOIN lieux_pays SCO on SCO.code = SC.pays
LEFT OUTER JOIN `livescores_new`.`matchs` LS on LS.tt_match_id = M.id
LEFT OUTER JOIN tournois_programmes S on S.idm = M.id
LEFT OUTER JOIN lieux_courts C on C.ids = S.ids && C.ordre = S.court
WHERE
M.id = '9432717'
&& M.type_tournoi_add = 0
&& (S.statut = 0 || S.statut = 4 || S.statut = 2 || ISNULL(S.statut))
UNION
SELECT
M.*
, M.time_start time_start
, M.time time_end
, M.duration_pause
, M.type_match_add type_match
, M.type_tournoi_add type_tournament
, CR.niveau level
, M.qualif
, M.idw winner_id
, P1.id p1_id
, P1.nom p1_name
, P1.prenom p1_first_name
, P1.name_zh p1_name_zh
, P1.birthday p1_birthday
, P1.sexe p1_gender
, P1.nat p1_nat
, P1.photo p1_photo
, P1.taille p1_height
, P1.poids p1_weight
, R1.rank p1_rank
, R1.liveRank p1_rank_live
, P1.pro_depuis p1_turn_pro
, '?' p1_best_rank
, P1.prise p1_forehand
, P1.revers p1_backhand
, M.ts1 p1_seed
, P1B.id p1b_id
, P1B.nom p1b_name
, P1B.prenom p1b_first_name
, P1B.name_zh p1b_name_zh
, P1B.birthday p1b_birthday
, P1B.sexe p1b_gender
, P1B.nat p1b_nat
, P1B.photo p1b_photo
, P1B.taille p1b_height
, P1B.poids p1b_weight
, R1B.rank p1b_rank
, R1B.liveRank p1b_rank_live
, P1B.pro_depuis p1b_turn_pro
, P2.id p2_id
, P2.nom p2_name
, P2.prenom p2_first_name
, P2.name_zh p2_name_zh
, P2.birthday p2_birthday
, P2.sexe p2_gender
, P2.nat p2_nat
, P2.photo p2_photo
, P2.taille p2_height
, P2.poids p2_weight
, R2.rank p2_rank
, R2.liveRank p2_rank_live
, P2.pro_depuis p2_turn_pro
, '?' p2_best_rank
, P2.prise p2_forehand
, P2.revers p2_backhand
, M.ts2 p2_seed
, P2B.id p2b_id
, P2B.nom p2b_name
, P2B.prenom p2b_first_name
, P2B.name_zh p2b_name_zh
, P2B.birthday p2b_birthday
, P2B.sexe p2b_gender
, P2B.nat p2b_nat
, P2B.photo p2b_photo
, P2B.taille p2b_height
, P2B.poids p2b_weight
, R2B.rank p2b_rank
, R2B.liveRank p2b_rank_live
, P2B.pro_depuis p2b_turn_pro
, C.id tournament_id
, C.parent tournament_idt
, CR.id rencontre_id
, N.name_fr tournament_name_fr
, N.name_en tournament_name_en
, N.name_zh tournament_name_zh
, N.name_de tournament_name_de
, N.name_es tournament_name_es
, CONCAT(CR.equipe_domicile, '|', CR.equipe_exterieur) tournament_city
, '' tournament_stadium
, CR.surface tournament_surface
, '' tournament_surface_photo
, '0' tournament_surface_color
, '' tournament_currency
, '' tournament_prize_money
, SCO.nom_fr tournament_country
, '' tournament_logo
, CR.date_d tournament_start
, '' tournament_end
, C.nbj tournament_nbPlayer
, '' tournament_genre
, '' tournament_category
, '' tournament_type
, CR.lieu tournament_site
, '' tournament_year
, 65 tournament_importance
, IF(T1.nom_fr, T1.nom_fr, CR.equipe_domicile) team1
, IF(T2.nom_fr, T1.nom_fr, CR.equipe_exterieur) team2
, 65 importance
, '' tournament_background
, SC.fuseau_horaire
, IF(ISNULL(LS.status) || M.status = 2 || M.status = 3 || M.status = 4, M.status, LS.status) match_status
, LS.serve
, S.time s_time_start
, S.court
, S.date_loc
, S.type s_type
, S.ordre s_order
, CT.nom court_name
, CT.ordre court_order
FROM
tournois_matchs M
INNER JOIN joueurs P1 on P1.id = M.j1
LEFT OUTER JOIN `joueurs` P1B on P1B.id = M.j1_bis
INNER JOIN joueurs P2 on P2.id = M.j2
LEFT OUTER JOIN `joueurs` P2B on P2B.id = M.j2_bis
LEFT JOIN tennis_rankings R1 on R1.player = P1.id AND R1.id = IF(P1.sexe = 1, 'wta', 'atp')
LEFT JOIN tennis_rankings R1B on R1B.player = P1B.id AND R1B.id = IF(P1B.sexe = 1, 'wta', 'atp')
LEFT JOIN tennis_rankings R2 on R2.player = P2.id AND R2.id = IF(P2.sexe = 1, 'wta', 'atp')
LEFT JOIN tennis_rankings R2B on R2B.player = P2B.id AND R2B.id = IF(P2B.sexe = 1, 'wta', 'atp')
LEFT OUTER JOIN `livescores_new`.`matchs` LS ON (LS.tt_match_id = M.id)
LEFT OUTER JOIN tournois_programmes S on S.idm = M.id
LEFT OUTER JOIN lieux_courts CT on (CT.ids = S.ids && CT.ordre = S.court)
INNER JOIN `coupes_rencontres` CR on CR.id = M.idt
INNER JOIN `coupes` C on C.id = CR.coupe_id
INNER JOIN tournois_name N on N.id = C.id
LEFT JOIN lieux_sites SL on SL.id = CR.lieu
LEFT JOIN lieux_villes SC on SC.id = SL.idv
LEFT JOIN lieux_pays SCO on SCO.code = SC.pays
LEFT JOIN `lieux_pays` T1 ON (T1.code = CR.equipe_domicile)
LEFT JOIN `lieux_pays` T2 ON (T2.code = CR.equipe_exterieur)
WHERE
M.id = '9432717'
&& M.type_tournoi_add = 1
&& (S.statut = 0 || S.statut = 4 || S.statut = 2 || ISNULL(S.statut))
UNION
SELECT
M.*
, M.time_start time_start
, M.time time_end
, M.duration_pause
, M.type_match_add type_match
, M.type_tournoi_add type_tournament
, '' level
, M.qualif
, M.idw winner_id
, P1.id p1_id
, P1.nom p1_name
, P1.prenom p1_first_name
, P1.name_zh p1_name_zh
, P1.birthday p1_birthday
, P1.sexe p1_gender
, P1.nat p1_nat
, P1.photo p1_photo
, P1.taille p1_height
, P1.poids p1_weight
, R1.rank p1_rank
, R1.liveRank p1_rank_live
, P1.pro_depuis p1_turn_pro
, '?' p1_best_rank
, P1.prise p1_forehand
, P1.revers p1_backhand
, M.ts1 p1_seed
, P1B.id p1b_id
, P1B.nom p1b_name
, P1B.prenom p1b_first_name
, P1B.name_zh p1b_name_zh
, P1B.birthday p1b_birthday
, P1B.sexe p1b_gender
, P1B.nat p1b_nat
, P1B.photo p1b_photo
, P1B.taille p1b_height
, P1B.poids p1b_weight
, R1B.rank p1b_rank
, R1B.liveRank p1b_rank_live
, P1B.pro_depuis p1b_turn_pro
, P2.id p2_id
, P2.nom p2_name
, P2.prenom p2_first_name
, P2.name_zh p2_name_zh
, P2.birthday p2_birthday
, P2.sexe p2_gender
, P2.nat p2_nat
, P2.photo p2_photo
, P2.taille p2_height
, P2.poids p2_weight
, R2.rank p2_rank
, R2.liveRank p2_rank_live
, P2.pro_depuis p2_turn_pro
, '?' p2_best_rank
, P2.prise p2_forehand
, P2.revers p2_backhand
, M.ts2 p2_seed
, P2B.id p2b_id
, P2B.nom p2b_name
, P2B.prenom p2b_first_name
, P2B.name_zh p2b_name_zh
, P2B.birthday p2b_birthday
, P2B.sexe p2b_gender
, P2B.nat p2b_nat
, P2B.photo p2b_photo
, P2B.taille p2b_height
, P2B.poids p2b_weight
, R2B.rank p2b_rank
, R2B.liveRank p2b_rank_live
, P2B.pro_depuis p2b_turn_pro
, L.id tournament_id
, 0 tournament_idt
, LR.id rencontre_id
, N.name_fr tournament_name_fr
, N.name_en tournament_name_en
, N.name_zh tournament_name_zh
, N.name_de tournament_name_de
, N.name_es tournament_name_es
, SC.nom tournament_city
, '' tournament_stadium
, '3' tournament_surface
, '' tournament_surface_photo
, '0' tournament_surface_color
, '' tournament_currency
, '' tournament_prize_money
, SCO.nom_fr tournament_country
, '' tournament_logo
, L.time_start tournament_start
, '' tournament_end
, '' tournament_nbPlayer
, '' tournament_genre
, '' tournament_category
, '' tournament_type
, LR.site tournament_site
, L.year tournament_year
, 0 tournament_importance
, '' team1
, '' team2
, 3 importance
, '' tournament_background
, SC.fuseau_horaire
, IF(ISNULL(LS.status) || M.status = 2 || M.status = 3 || M.status = 4, M.status, LS.status) match_status
, LS.serve
, S.time s_time_start
, S.court
, S.date_loc
, S.type s_type
, S.ordre s_order
, CT.nom court_name
, CT.ordre court_order
FROM
tournois_matchs M
JOIN joueurs P1 on P1.id = M.j1
LEFT JOIN `joueurs` P1B on P1B.id = M.j1_bis
JOIN joueurs P2 on P2.id = M.j2
LEFT JOIN `joueurs` P2B on P2B.id = M.j2_bis
LEFT JOIN tennis_rankings R1 on R1.player = P1.id AND R1.id = IF(P1.sexe = 1, 'wta', 'atp')
LEFT JOIN tennis_rankings R1B on R1B.player = P1B.id AND R1B.id = IF(P1B.sexe = 1, 'wta', 'atp')
LEFT JOIN tennis_rankings R2 on R2.player = P2.id AND R2.id = IF(P2.sexe = 1, 'wta', 'atp')
LEFT JOIN tennis_rankings R2B on R2B.player = P2B.id AND R2B.id = IF(P2B.sexe = 1, 'wta', 'atp')
LEFT JOIN `livescores_new`.`matchs` LS ON (LS.tt_match_id = M.id)
LEFT JOIN tournois_programmes S on S.idm = M.id
LEFT JOIN lieux_courts CT on (CT.ids = S.ids && CT.ordre = S.court)
JOIN `leagues_rounds` LR on LR.id = M.league_round
JOIN `leagues` L on L.id = LR.league
JOIN tournois_name N on N.league = L.id
LEFT JOIN lieux_sites SL on SL.id = LR.site
LEFT JOIN lieux_villes SC on SC.id = SL.idv
LEFT JOIN lieux_pays SCO on SCO.code = SC.pays
WHERE
M.id = '9432717'
&& M.type_tournoi_add = 2
&& (S.statut = 0 || S.statut = 4 || S.statut = 2 || ISNULL(S.statut))
LIMIT 1
SELECT M.*
, M.time_start time_start
, M.time time_end
, M.duration_pause
, M.type_match_add type_match
, M.type_tournoi_add type_tournament
, M.niveau level
, M.qualif
, M.idw winner_id
, P1.id p1_id
, P1.nom p1_name
, P1.prenom p1_first_name
, P1.name_zh p1_name_zh
, P1.birthday p1_birthday
, P1.sexe p1_gender
, P1.nat p1_nat
, P1.photo p1_photo
, P1.taille p1_height
, P1.poids p1_weight
, R1.rank p1_rank
, R1.liveRank p1_rank_live
, P1.pro_depuis p1_turn_pro
, '?' p1_best_rank
, P1.prise p1_forehand
, P1.revers p1_backhand
, M.ts1 p1_seed
, P1B.id p1b_id
, P1B.nom p1b_name
, P1B.prenom p1b_first_name
, P1B.name_zh p1b_name_zh
, P1B.birthday p1b_birthday
, P1B.sexe p1b_gender
, P1B.nat p1b_nat
, P1B.photo p1b_photo
, P1B.taille p1b_height
, P1B.poids p1b_weight
, R1B.rank p1b_rank
, R1B.liveRank p1b_rank_live
, P1B.pro_depuis p1b_turn_pro
, P2.id p2_id
, P2.nom p2_name
, P2.prenom p2_first_name
, P2.name_zh p2_name_zh
, P2.birthday p2_birthday
, P2.sexe p2_gender
, P2.nat p2_nat
, P2.photo p2_photo
, P2.taille p2_height
, P2.poids p2_weight
, R2.rank p2_rank
, R2.liveRank p2_rank_live
, P2.pro_depuis p2_turn_pro
, '?' p2_best_rank
, P2.prise p2_forehand
, P2.revers p2_backhand
, M.ts2 p2_seed
, P2B.id p2b_id
, P2B.nom p2b_name
, P2B.prenom p2b_first_name
, P2B.name_zh p2b_name_zh
, P2B.birthday p2b_birthday
, P2B.sexe p2b_gender
, P2B.nat p2b_nat
, P2B.photo p2b_photo
, P2B.taille p2b_height
, P2B.poids p2b_weight
, R2B.rank p2b_rank
, R2B.liveRank p2b_rank_live
, P2B.pro_depuis p2b_turn_pro
, T.id tournament_id
, T.idt tournament_idt
, '?' rencontre_id
, N.name_fr tournament_name_fr
, N.name_en tournament_name_en
, N.name_zh tournament_name_zh
, N.name_de tournament_name_de
, N.name_es tournament_name_es
, T.ville tournament_city
, T.stade tournament_stadium
, T.surface tournament_surface
, T.surface_photo tournament_surface_photo
, T.surface_color tournament_surface_color
, T.monnaie tournament_currency
, T.prix tournament_prize_money
, SCO.nom_fr tournament_country
, T.logo tournament_logo
, T.debut tournament_start
, T.fin tournament_end
, T.nbj tournament_nbPlayer
, T.genre tournament_genre
, T.category tournament_category
, T.type tournament_type
, T.ids tournament_site
, T.year tournament_year
, T.importance tournament_importance
, '' team1
, '' team2
, T.importance
, T.background tournament_background
, SC.fuseau_horaire
, IF(ISNULL(LS.status) || M.status = 2 || M.status = 3 || M.status = 4, M.status, LS.status) match_status
, LS.serve
, S.time s_time_start
, S.court
, S.date_loc
, S.type s_type
, S.ordre s_order
, C.nom court_name
, C.ordre court_order
FROM
tournois_matchs M
INNER JOIN joueurs P1 on P1.id = M.j1
LEFT OUTER JOIN `joueurs` P1B on P1B.id = M.j1_bis
INNER JOIN joueurs P2 on P2.id = M.j2
LEFT OUTER JOIN `joueurs` P2B on P2B.id = M.j2_bis
LEFT JOIN tennis_rankings R1 on R1.player = P1.id AND R1.id = IF(P1.sexe = 1, 'wta', 'atp')
LEFT JOIN tennis_rankings R1B on R1B.player = P1B.id AND R1B.id = IF(P1B.sexe = 1, 'wta', 'atp')
LEFT JOIN tennis_rankings R2 on R2.player = P2.id AND R2.id = IF(P2.sexe = 1, 'wta', 'atp')
LEFT JOIN tennis_rankings R2B on R2B.player = P2B.id AND R2B.id = IF(P2B.sexe = 1, 'wta', 'atp')
INNER JOIN tournois T on T.id = M.idt
INNER JOIN tournois_name N on N.id = T.id && N.cup = 0
LEFT OUTER JOIN lieux_sites SL on T.ids = SL.id
LEFT OUTER JOIN lieux_villes SC on SL.idv = SC.id
LEFT OUTER JOIN lieux_pays SCO on SCO.code = SC.pays
LEFT OUTER JOIN `livescores_new`.`matchs` LS on LS.tt_match_id = M.id
LEFT OUTER JOIN tournois_programmes S on S.idm = M.id
LEFT OUTER JOIN lieux_courts C on C.ids = S.ids && C.ordre = S.court
WHERE
M.id = '9432718'
&& M.type_tournoi_add = 0
&& (S.statut = 0 || S.statut = 4 || S.statut = 2 || ISNULL(S.statut))
UNION
SELECT
M.*
, M.time_start time_start
, M.time time_end
, M.duration_pause
, M.type_match_add type_match
, M.type_tournoi_add type_tournament
, CR.niveau level
, M.qualif
, M.idw winner_id
, P1.id p1_id
, P1.nom p1_name
, P1.prenom p1_first_name
, P1.name_zh p1_name_zh
, P1.birthday p1_birthday
, P1.sexe p1_gender
, P1.nat p1_nat
, P1.photo p1_photo
, P1.taille p1_height
, P1.poids p1_weight
, R1.rank p1_rank
, R1.liveRank p1_rank_live
, P1.pro_depuis p1_turn_pro
, '?' p1_best_rank
, P1.prise p1_forehand
, P1.revers p1_backhand
, M.ts1 p1_seed
, P1B.id p1b_id
, P1B.nom p1b_name
, P1B.prenom p1b_first_name
, P1B.name_zh p1b_name_zh
, P1B.birthday p1b_birthday
, P1B.sexe p1b_gender
, P1B.nat p1b_nat
, P1B.photo p1b_photo
, P1B.taille p1b_height
, P1B.poids p1b_weight
, R1B.rank p1b_rank
, R1B.liveRank p1b_rank_live
, P1B.pro_depuis p1b_turn_pro
, P2.id p2_id
, P2.nom p2_name
, P2.prenom p2_first_name
, P2.name_zh p2_name_zh
, P2.birthday p2_birthday
, P2.sexe p2_gender
, P2.nat p2_nat
, P2.photo p2_photo
, P2.taille p2_height
, P2.poids p2_weight
, R2.rank p2_rank
, R2.liveRank p2_rank_live
, P2.pro_depuis p2_turn_pro
, '?' p2_best_rank
, P2.prise p2_forehand
, P2.revers p2_backhand
, M.ts2 p2_seed
, P2B.id p2b_id
, P2B.nom p2b_name
, P2B.prenom p2b_first_name
, P2B.name_zh p2b_name_zh
, P2B.birthday p2b_birthday
, P2B.sexe p2b_gender
, P2B.nat p2b_nat
, P2B.photo p2b_photo
, P2B.taille p2b_height
, P2B.poids p2b_weight
, R2B.rank p2b_rank
, R2B.liveRank p2b_rank_live
, P2B.pro_depuis p2b_turn_pro
, C.id tournament_id
, C.parent tournament_idt
, CR.id rencontre_id
, N.name_fr tournament_name_fr
, N.name_en tournament_name_en
, N.name_zh tournament_name_zh
, N.name_de tournament_name_de
, N.name_es tournament_name_es
, CONCAT(CR.equipe_domicile, '|', CR.equipe_exterieur) tournament_city
, '' tournament_stadium
, CR.surface tournament_surface
, '' tournament_surface_photo
, '0' tournament_surface_color
, '' tournament_currency
, '' tournament_prize_money
, SCO.nom_fr tournament_country
, '' tournament_logo
, CR.date_d tournament_start
, '' tournament_end
, C.nbj tournament_nbPlayer
, '' tournament_genre
, '' tournament_category
, '' tournament_type
, CR.lieu tournament_site
, '' tournament_year
, 65 tournament_importance
, IF(T1.nom_fr, T1.nom_fr, CR.equipe_domicile) team1
, IF(T2.nom_fr, T1.nom_fr, CR.equipe_exterieur) team2
, 65 importance
, '' tournament_background
, SC.fuseau_horaire
, IF(ISNULL(LS.status) || M.status = 2 || M.status = 3 || M.status = 4, M.status, LS.status) match_status
, LS.serve
, S.time s_time_start
, S.court
, S.date_loc
, S.type s_type
, S.ordre s_order
, CT.nom court_name
, CT.ordre court_order
FROM
tournois_matchs M
INNER JOIN joueurs P1 on P1.id = M.j1
LEFT OUTER JOIN `joueurs` P1B on P1B.id = M.j1_bis
INNER JOIN joueurs P2 on P2.id = M.j2
LEFT OUTER JOIN `joueurs` P2B on P2B.id = M.j2_bis
LEFT JOIN tennis_rankings R1 on R1.player = P1.id AND R1.id = IF(P1.sexe = 1, 'wta', 'atp')
LEFT JOIN tennis_rankings R1B on R1B.player = P1B.id AND R1B.id = IF(P1B.sexe = 1, 'wta', 'atp')
LEFT JOIN tennis_rankings R2 on R2.player = P2.id AND R2.id = IF(P2.sexe = 1, 'wta', 'atp')
LEFT JOIN tennis_rankings R2B on R2B.player = P2B.id AND R2B.id = IF(P2B.sexe = 1, 'wta', 'atp')
LEFT OUTER JOIN `livescores_new`.`matchs` LS ON (LS.tt_match_id = M.id)
LEFT OUTER JOIN tournois_programmes S on S.idm = M.id
LEFT OUTER JOIN lieux_courts CT on (CT.ids = S.ids && CT.ordre = S.court)
INNER JOIN `coupes_rencontres` CR on CR.id = M.idt
INNER JOIN `coupes` C on C.id = CR.coupe_id
INNER JOIN tournois_name N on N.id = C.id
LEFT JOIN lieux_sites SL on SL.id = CR.lieu
LEFT JOIN lieux_villes SC on SC.id = SL.idv
LEFT JOIN lieux_pays SCO on SCO.code = SC.pays
LEFT JOIN `lieux_pays` T1 ON (T1.code = CR.equipe_domicile)
LEFT JOIN `lieux_pays` T2 ON (T2.code = CR.equipe_exterieur)
WHERE
M.id = '9432718'
&& M.type_tournoi_add = 1
&& (S.statut = 0 || S.statut = 4 || S.statut = 2 || ISNULL(S.statut))
UNION
SELECT
M.*
, M.time_start time_start
, M.time time_end
, M.duration_pause
, M.type_match_add type_match
, M.type_tournoi_add type_tournament
, '' level
, M.qualif
, M.idw winner_id
, P1.id p1_id
, P1.nom p1_name
, P1.prenom p1_first_name
, P1.name_zh p1_name_zh
, P1.birthday p1_birthday
, P1.sexe p1_gender
, P1.nat p1_nat
, P1.photo p1_photo
, P1.taille p1_height
, P1.poids p1_weight
, R1.rank p1_rank
, R1.liveRank p1_rank_live
, P1.pro_depuis p1_turn_pro
, '?' p1_best_rank
, P1.prise p1_forehand
, P1.revers p1_backhand
, M.ts1 p1_seed
, P1B.id p1b_id
, P1B.nom p1b_name
, P1B.prenom p1b_first_name
, P1B.name_zh p1b_name_zh
, P1B.birthday p1b_birthday
, P1B.sexe p1b_gender
, P1B.nat p1b_nat
, P1B.photo p1b_photo
, P1B.taille p1b_height
, P1B.poids p1b_weight
, R1B.rank p1b_rank
, R1B.liveRank p1b_rank_live
, P1B.pro_depuis p1b_turn_pro
, P2.id p2_id
, P2.nom p2_name
, P2.prenom p2_first_name
, P2.name_zh p2_name_zh
, P2.birthday p2_birthday
, P2.sexe p2_gender
, P2.nat p2_nat
, P2.photo p2_photo
, P2.taille p2_height
, P2.poids p2_weight
, R2.rank p2_rank
, R2.liveRank p2_rank_live
, P2.pro_depuis p2_turn_pro
, '?' p2_best_rank
, P2.prise p2_forehand
, P2.revers p2_backhand
, M.ts2 p2_seed
, P2B.id p2b_id
, P2B.nom p2b_name
, P2B.prenom p2b_first_name
, P2B.name_zh p2b_name_zh
, P2B.birthday p2b_birthday
, P2B.sexe p2b_gender
, P2B.nat p2b_nat
, P2B.photo p2b_photo
, P2B.taille p2b_height
, P2B.poids p2b_weight
, R2B.rank p2b_rank
, R2B.liveRank p2b_rank_live
, P2B.pro_depuis p2b_turn_pro
, L.id tournament_id
, 0 tournament_idt
, LR.id rencontre_id
, N.name_fr tournament_name_fr
, N.name_en tournament_name_en
, N.name_zh tournament_name_zh
, N.name_de tournament_name_de
, N.name_es tournament_name_es
, SC.nom tournament_city
, '' tournament_stadium
, '3' tournament_surface
, '' tournament_surface_photo
, '0' tournament_surface_color
, '' tournament_currency
, '' tournament_prize_money
, SCO.nom_fr tournament_country
, '' tournament_logo
, L.time_start tournament_start
, '' tournament_end
, '' tournament_nbPlayer
, '' tournament_genre
, '' tournament_category
, '' tournament_type
, LR.site tournament_site
, L.year tournament_year
, 0 tournament_importance
, '' team1
, '' team2
, 3 importance
, '' tournament_background
, SC.fuseau_horaire
, IF(ISNULL(LS.status) || M.status = 2 || M.status = 3 || M.status = 4, M.status, LS.status) match_status
, LS.serve
, S.time s_time_start
, S.court
, S.date_loc
, S.type s_type
, S.ordre s_order
, CT.nom court_name
, CT.ordre court_order
FROM
tournois_matchs M
JOIN joueurs P1 on P1.id = M.j1
LEFT JOIN `joueurs` P1B on P1B.id = M.j1_bis
JOIN joueurs P2 on P2.id = M.j2
LEFT JOIN `joueurs` P2B on P2B.id = M.j2_bis
LEFT JOIN tennis_rankings R1 on R1.player = P1.id AND R1.id = IF(P1.sexe = 1, 'wta', 'atp')
LEFT JOIN tennis_rankings R1B on R1B.player = P1B.id AND R1B.id = IF(P1B.sexe = 1, 'wta', 'atp')
LEFT JOIN tennis_rankings R2 on R2.player = P2.id AND R2.id = IF(P2.sexe = 1, 'wta', 'atp')
LEFT JOIN tennis_rankings R2B on R2B.player = P2B.id AND R2B.id = IF(P2B.sexe = 1, 'wta', 'atp')
LEFT JOIN `livescores_new`.`matchs` LS ON (LS.tt_match_id = M.id)
LEFT JOIN tournois_programmes S on S.idm = M.id
LEFT JOIN lieux_courts CT on (CT.ids = S.ids && CT.ordre = S.court)
JOIN `leagues_rounds` LR on LR.id = M.league_round
JOIN `leagues` L on L.id = LR.league
JOIN tournois_name N on N.league = L.id
LEFT JOIN lieux_sites SL on SL.id = LR.site
LEFT JOIN lieux_villes SC on SC.id = SL.idv
LEFT JOIN lieux_pays SCO on SCO.code = SC.pays
WHERE
M.id = '9432718'
&& M.type_tournoi_add = 2
&& (S.statut = 0 || S.statut = 4 || S.statut = 2 || ISNULL(S.statut))
LIMIT 1
SELECT M.*
, M.time_start time_start
, M.time time_end
, M.duration_pause
, M.type_match_add type_match
, M.type_tournoi_add type_tournament
, M.niveau level
, M.qualif
, M.idw winner_id
, P1.id p1_id
, P1.nom p1_name
, P1.prenom p1_first_name
, P1.name_zh p1_name_zh
, P1.birthday p1_birthday
, P1.sexe p1_gender
, P1.nat p1_nat
, P1.photo p1_photo
, P1.taille p1_height
, P1.poids p1_weight
, R1.rank p1_rank
, R1.liveRank p1_rank_live
, P1.pro_depuis p1_turn_pro
, '?' p1_best_rank
, P1.prise p1_forehand
, P1.revers p1_backhand
, M.ts1 p1_seed
, P1B.id p1b_id
, P1B.nom p1b_name
, P1B.prenom p1b_first_name
, P1B.name_zh p1b_name_zh
, P1B.birthday p1b_birthday
, P1B.sexe p1b_gender
, P1B.nat p1b_nat
, P1B.photo p1b_photo
, P1B.taille p1b_height
, P1B.poids p1b_weight
, R1B.rank p1b_rank
, R1B.liveRank p1b_rank_live
, P1B.pro_depuis p1b_turn_pro
, P2.id p2_id
, P2.nom p2_name
, P2.prenom p2_first_name
, P2.name_zh p2_name_zh
, P2.birthday p2_birthday
, P2.sexe p2_gender
, P2.nat p2_nat
, P2.photo p2_photo
, P2.taille p2_height
, P2.poids p2_weight
, R2.rank p2_rank
, R2.liveRank p2_rank_live
, P2.pro_depuis p2_turn_pro
, '?' p2_best_rank
, P2.prise p2_forehand
, P2.revers p2_backhand
, M.ts2 p2_seed
, P2B.id p2b_id
, P2B.nom p2b_name
, P2B.prenom p2b_first_name
, P2B.name_zh p2b_name_zh
, P2B.birthday p2b_birthday
, P2B.sexe p2b_gender
, P2B.nat p2b_nat
, P2B.photo p2b_photo
, P2B.taille p2b_height
, P2B.poids p2b_weight
, R2B.rank p2b_rank
, R2B.liveRank p2b_rank_live
, P2B.pro_depuis p2b_turn_pro
, T.id tournament_id
, T.idt tournament_idt
, '?' rencontre_id
, N.name_fr tournament_name_fr
, N.name_en tournament_name_en
, N.name_zh tournament_name_zh
, N.name_de tournament_name_de
, N.name_es tournament_name_es
, T.ville tournament_city
, T.stade tournament_stadium
, T.surface tournament_surface
, T.surface_photo tournament_surface_photo
, T.surface_color tournament_surface_color
, T.monnaie tournament_currency
, T.prix tournament_prize_money
, SCO.nom_fr tournament_country
, T.logo tournament_logo
, T.debut tournament_start
, T.fin tournament_end
, T.nbj tournament_nbPlayer
, T.genre tournament_genre
, T.category tournament_category
, T.type tournament_type
, T.ids tournament_site
, T.year tournament_year
, T.importance tournament_importance
, '' team1
, '' team2
, T.importance
, T.background tournament_background
, SC.fuseau_horaire
, IF(ISNULL(LS.status) || M.status = 2 || M.status = 3 || M.status = 4, M.status, LS.status) match_status
, LS.serve
, S.time s_time_start
, S.court
, S.date_loc
, S.type s_type
, S.ordre s_order
, C.nom court_name
, C.ordre court_order
FROM
tournois_matchs M
INNER JOIN joueurs P1 on P1.id = M.j1
LEFT OUTER JOIN `joueurs` P1B on P1B.id = M.j1_bis
INNER JOIN joueurs P2 on P2.id = M.j2
LEFT OUTER JOIN `joueurs` P2B on P2B.id = M.j2_bis
LEFT JOIN tennis_rankings R1 on R1.player = P1.id AND R1.id = IF(P1.sexe = 1, 'wta', 'atp')
LEFT JOIN tennis_rankings R1B on R1B.player = P1B.id AND R1B.id = IF(P1B.sexe = 1, 'wta', 'atp')
LEFT JOIN tennis_rankings R2 on R2.player = P2.id AND R2.id = IF(P2.sexe = 1, 'wta', 'atp')
LEFT JOIN tennis_rankings R2B on R2B.player = P2B.id AND R2B.id = IF(P2B.sexe = 1, 'wta', 'atp')
INNER JOIN tournois T on T.id = M.idt
INNER JOIN tournois_name N on N.id = T.id && N.cup = 0
LEFT OUTER JOIN lieux_sites SL on T.ids = SL.id
LEFT OUTER JOIN lieux_villes SC on SL.idv = SC.id
LEFT OUTER JOIN lieux_pays SCO on SCO.code = SC.pays
LEFT OUTER JOIN `livescores_new`.`matchs` LS on LS.tt_match_id = M.id
LEFT OUTER JOIN tournois_programmes S on S.idm = M.id
LEFT OUTER JOIN lieux_courts C on C.ids = S.ids && C.ordre = S.court
WHERE
M.id = '9432724'
&& M.type_tournoi_add = 0
&& (S.statut = 0 || S.statut = 4 || S.statut = 2 || ISNULL(S.statut))
UNION
SELECT
M.*
, M.time_start time_start
, M.time time_end
, M.duration_pause
, M.type_match_add type_match
, M.type_tournoi_add type_tournament
, CR.niveau level
, M.qualif
, M.idw winner_id
, P1.id p1_id
, P1.nom p1_name
, P1.prenom p1_first_name
, P1.name_zh p1_name_zh
, P1.birthday p1_birthday
, P1.sexe p1_gender
, P1.nat p1_nat
, P1.photo p1_photo
, P1.taille p1_height
, P1.poids p1_weight
, R1.rank p1_rank
, R1.liveRank p1_rank_live
, P1.pro_depuis p1_turn_pro
, '?' p1_best_rank
, P1.prise p1_forehand
, P1.revers p1_backhand
, M.ts1 p1_seed
, P1B.id p1b_id
, P1B.nom p1b_name
, P1B.prenom p1b_first_name
, P1B.name_zh p1b_name_zh
, P1B.birthday p1b_birthday
, P1B.sexe p1b_gender
, P1B.nat p1b_nat
, P1B.photo p1b_photo
, P1B.taille p1b_height
, P1B.poids p1b_weight
, R1B.rank p1b_rank
, R1B.liveRank p1b_rank_live
, P1B.pro_depuis p1b_turn_pro
, P2.id p2_id
, P2.nom p2_name
, P2.prenom p2_first_name
, P2.name_zh p2_name_zh
, P2.birthday p2_birthday
, P2.sexe p2_gender
, P2.nat p2_nat
, P2.photo p2_photo
, P2.taille p2_height
, P2.poids p2_weight
, R2.rank p2_rank
, R2.liveRank p2_rank_live
, P2.pro_depuis p2_turn_pro
, '?' p2_best_rank
, P2.prise p2_forehand
, P2.revers p2_backhand
, M.ts2 p2_seed
, P2B.id p2b_id
, P2B.nom p2b_name
, P2B.prenom p2b_first_name
, P2B.name_zh p2b_name_zh
, P2B.birthday p2b_birthday
, P2B.sexe p2b_gender
, P2B.nat p2b_nat
, P2B.photo p2b_photo
, P2B.taille p2b_height
, P2B.poids p2b_weight
, R2B.rank p2b_rank
, R2B.liveRank p2b_rank_live
, P2B.pro_depuis p2b_turn_pro
, C.id tournament_id
, C.parent tournament_idt
, CR.id rencontre_id
, N.name_fr tournament_name_fr
, N.name_en tournament_name_en
, N.name_zh tournament_name_zh
, N.name_de tournament_name_de
, N.name_es tournament_name_es
, CONCAT(CR.equipe_domicile, '|', CR.equipe_exterieur) tournament_city
, '' tournament_stadium
, CR.surface tournament_surface
, '' tournament_surface_photo
, '0' tournament_surface_color
, '' tournament_currency
, '' tournament_prize_money
, SCO.nom_fr tournament_country
, '' tournament_logo
, CR.date_d tournament_start
, '' tournament_end
, C.nbj tournament_nbPlayer
, '' tournament_genre
, '' tournament_category
, '' tournament_type
, CR.lieu tournament_site
, '' tournament_year
, 65 tournament_importance
, IF(T1.nom_fr, T1.nom_fr, CR.equipe_domicile) team1
, IF(T2.nom_fr, T1.nom_fr, CR.equipe_exterieur) team2
, 65 importance
, '' tournament_background
, SC.fuseau_horaire
, IF(ISNULL(LS.status) || M.status = 2 || M.status = 3 || M.status = 4, M.status, LS.status) match_status
, LS.serve
, S.time s_time_start
, S.court
, S.date_loc
, S.type s_type
, S.ordre s_order
, CT.nom court_name
, CT.ordre court_order
FROM
tournois_matchs M
INNER JOIN joueurs P1 on P1.id = M.j1
LEFT OUTER JOIN `joueurs` P1B on P1B.id = M.j1_bis
INNER JOIN joueurs P2 on P2.id = M.j2
LEFT OUTER JOIN `joueurs` P2B on P2B.id = M.j2_bis
LEFT JOIN tennis_rankings R1 on R1.player = P1.id AND R1.id = IF(P1.sexe = 1, 'wta', 'atp')
LEFT JOIN tennis_rankings R1B on R1B.player = P1B.id AND R1B.id = IF(P1B.sexe = 1, 'wta', 'atp')
LEFT JOIN tennis_rankings R2 on R2.player = P2.id AND R2.id = IF(P2.sexe = 1, 'wta', 'atp')
LEFT JOIN tennis_rankings R2B on R2B.player = P2B.id AND R2B.id = IF(P2B.sexe = 1, 'wta', 'atp')
LEFT OUTER JOIN `livescores_new`.`matchs` LS ON (LS.tt_match_id = M.id)
LEFT OUTER JOIN tournois_programmes S on S.idm = M.id
LEFT OUTER JOIN lieux_courts CT on (CT.ids = S.ids && CT.ordre = S.court)
INNER JOIN `coupes_rencontres` CR on CR.id = M.idt
INNER JOIN `coupes` C on C.id = CR.coupe_id
INNER JOIN tournois_name N on N.id = C.id
LEFT JOIN lieux_sites SL on SL.id = CR.lieu
LEFT JOIN lieux_villes SC on SC.id = SL.idv
LEFT JOIN lieux_pays SCO on SCO.code = SC.pays
LEFT JOIN `lieux_pays` T1 ON (T1.code = CR.equipe_domicile)
LEFT JOIN `lieux_pays` T2 ON (T2.code = CR.equipe_exterieur)
WHERE
M.id = '9432724'
&& M.type_tournoi_add = 1
&& (S.statut = 0 || S.statut = 4 || S.statut = 2 || ISNULL(S.statut))
UNION
SELECT
M.*
, M.time_start time_start
, M.time time_end
, M.duration_pause
, M.type_match_add type_match
, M.type_tournoi_add type_tournament
, '' level
, M.qualif
, M.idw winner_id
, P1.id p1_id
, P1.nom p1_name
, P1.prenom p1_first_name
, P1.name_zh p1_name_zh
, P1.birthday p1_birthday
, P1.sexe p1_gender
, P1.nat p1_nat
, P1.photo p1_photo
, P1.taille p1_height
, P1.poids p1_weight
, R1.rank p1_rank
, R1.liveRank p1_rank_live
, P1.pro_depuis p1_turn_pro
, '?' p1_best_rank
, P1.prise p1_forehand
, P1.revers p1_backhand
, M.ts1 p1_seed
, P1B.id p1b_id
, P1B.nom p1b_name
, P1B.prenom p1b_first_name
, P1B.name_zh p1b_name_zh
, P1B.birthday p1b_birthday
, P1B.sexe p1b_gender
, P1B.nat p1b_nat
, P1B.photo p1b_photo
, P1B.taille p1b_height
, P1B.poids p1b_weight
, R1B.rank p1b_rank
, R1B.liveRank p1b_rank_live
, P1B.pro_depuis p1b_turn_pro
, P2.id p2_id
, P2.nom p2_name
, P2.prenom p2_first_name
, P2.name_zh p2_name_zh
, P2.birthday p2_birthday
, P2.sexe p2_gender
, P2.nat p2_nat
, P2.photo p2_photo
, P2.taille p2_height
, P2.poids p2_weight
, R2.rank p2_rank
, R2.liveRank p2_rank_live
, P2.pro_depuis p2_turn_pro
, '?' p2_best_rank
, P2.prise p2_forehand
, P2.revers p2_backhand
, M.ts2 p2_seed
, P2B.id p2b_id
, P2B.nom p2b_name
, P2B.prenom p2b_first_name
, P2B.name_zh p2b_name_zh
, P2B.birthday p2b_birthday
, P2B.sexe p2b_gender
, P2B.nat p2b_nat
, P2B.photo p2b_photo
, P2B.taille p2b_height
, P2B.poids p2b_weight
, R2B.rank p2b_rank
, R2B.liveRank p2b_rank_live
, P2B.pro_depuis p2b_turn_pro
, L.id tournament_id
, 0 tournament_idt
, LR.id rencontre_id
, N.name_fr tournament_name_fr
, N.name_en tournament_name_en
, N.name_zh tournament_name_zh
, N.name_de tournament_name_de
, N.name_es tournament_name_es
, SC.nom tournament_city
, '' tournament_stadium
, '3' tournament_surface
, '' tournament_surface_photo
, '0' tournament_surface_color
, '' tournament_currency
, '' tournament_prize_money
, SCO.nom_fr tournament_country
, '' tournament_logo
, L.time_start tournament_start
, '' tournament_end
, '' tournament_nbPlayer
, '' tournament_genre
, '' tournament_category
, '' tournament_type
, LR.site tournament_site
, L.year tournament_year
, 0 tournament_importance
, '' team1
, '' team2
, 3 importance
, '' tournament_background
, SC.fuseau_horaire
, IF(ISNULL(LS.status) || M.status = 2 || M.status = 3 || M.status = 4, M.status, LS.status) match_status
, LS.serve
, S.time s_time_start
, S.court
, S.date_loc
, S.type s_type
, S.ordre s_order
, CT.nom court_name
, CT.ordre court_order
FROM
tournois_matchs M
JOIN joueurs P1 on P1.id = M.j1
LEFT JOIN `joueurs` P1B on P1B.id = M.j1_bis
JOIN joueurs P2 on P2.id = M.j2
LEFT JOIN `joueurs` P2B on P2B.id = M.j2_bis
LEFT JOIN tennis_rankings R1 on R1.player = P1.id AND R1.id = IF(P1.sexe = 1, 'wta', 'atp')
LEFT JOIN tennis_rankings R1B on R1B.player = P1B.id AND R1B.id = IF(P1B.sexe = 1, 'wta', 'atp')
LEFT JOIN tennis_rankings R2 on R2.player = P2.id AND R2.id = IF(P2.sexe = 1, 'wta', 'atp')
LEFT JOIN tennis_rankings R2B on R2B.player = P2B.id AND R2B.id = IF(P2B.sexe = 1, 'wta', 'atp')
LEFT JOIN `livescores_new`.`matchs` LS ON (LS.tt_match_id = M.id)
LEFT JOIN tournois_programmes S on S.idm = M.id
LEFT JOIN lieux_courts CT on (CT.ids = S.ids && CT.ordre = S.court)
JOIN `leagues_rounds` LR on LR.id = M.league_round
JOIN `leagues` L on L.id = LR.league
JOIN tournois_name N on N.league = L.id
LEFT JOIN lieux_sites SL on SL.id = LR.site
LEFT JOIN lieux_villes SC on SC.id = SL.idv
LEFT JOIN lieux_pays SCO on SCO.code = SC.pays
WHERE
M.id = '9432724'
&& M.type_tournoi_add = 2
&& (S.statut = 0 || S.statut = 4 || S.statut = 2 || ISNULL(S.statut))
LIMIT 1
SELECT M.*
, M.time_start time_start
, M.time time_end
, M.duration_pause
, M.type_match_add type_match
, M.type_tournoi_add type_tournament
, M.niveau level
, M.qualif
, M.idw winner_id
, P1.id p1_id
, P1.nom p1_name
, P1.prenom p1_first_name
, P1.name_zh p1_name_zh
, P1.birthday p1_birthday
, P1.sexe p1_gender
, P1.nat p1_nat
, P1.photo p1_photo
, P1.taille p1_height
, P1.poids p1_weight
, R1.rank p1_rank
, R1.liveRank p1_rank_live
, P1.pro_depuis p1_turn_pro
, '?' p1_best_rank
, P1.prise p1_forehand
, P1.revers p1_backhand
, M.ts1 p1_seed
, P1B.id p1b_id
, P1B.nom p1b_name
, P1B.prenom p1b_first_name
, P1B.name_zh p1b_name_zh
, P1B.birthday p1b_birthday
, P1B.sexe p1b_gender
, P1B.nat p1b_nat
, P1B.photo p1b_photo
, P1B.taille p1b_height
, P1B.poids p1b_weight
, R1B.rank p1b_rank
, R1B.liveRank p1b_rank_live
, P1B.pro_depuis p1b_turn_pro
, P2.id p2_id
, P2.nom p2_name
, P2.prenom p2_first_name
, P2.name_zh p2_name_zh
, P2.birthday p2_birthday
, P2.sexe p2_gender
, P2.nat p2_nat
, P2.photo p2_photo
, P2.taille p2_height
, P2.poids p2_weight
, R2.rank p2_rank
, R2.liveRank p2_rank_live
, P2.pro_depuis p2_turn_pro
, '?' p2_best_rank
, P2.prise p2_forehand
, P2.revers p2_backhand
, M.ts2 p2_seed
, P2B.id p2b_id
, P2B.nom p2b_name
, P2B.prenom p2b_first_name
, P2B.name_zh p2b_name_zh
, P2B.birthday p2b_birthday
, P2B.sexe p2b_gender
, P2B.nat p2b_nat
, P2B.photo p2b_photo
, P2B.taille p2b_height
, P2B.poids p2b_weight
, R2B.rank p2b_rank
, R2B.liveRank p2b_rank_live
, P2B.pro_depuis p2b_turn_pro
, T.id tournament_id
, T.idt tournament_idt
, '?' rencontre_id
, N.name_fr tournament_name_fr
, N.name_en tournament_name_en
, N.name_zh tournament_name_zh
, N.name_de tournament_name_de
, N.name_es tournament_name_es
, T.ville tournament_city
, T.stade tournament_stadium
, T.surface tournament_surface
, T.surface_photo tournament_surface_photo
, T.surface_color tournament_surface_color
, T.monnaie tournament_currency
, T.prix tournament_prize_money
, SCO.nom_fr tournament_country
, T.logo tournament_logo
, T.debut tournament_start
, T.fin tournament_end
, T.nbj tournament_nbPlayer
, T.genre tournament_genre
, T.category tournament_category
, T.type tournament_type
, T.ids tournament_site
, T.year tournament_year
, T.importance tournament_importance
, '' team1
, '' team2
, T.importance
, T.background tournament_background
, SC.fuseau_horaire
, IF(ISNULL(LS.status) || M.status = 2 || M.status = 3 || M.status = 4, M.status, LS.status) match_status
, LS.serve
, S.time s_time_start
, S.court
, S.date_loc
, S.type s_type
, S.ordre s_order
, C.nom court_name
, C.ordre court_order
FROM
tournois_matchs M
INNER JOIN joueurs P1 on P1.id = M.j1
LEFT OUTER JOIN `joueurs` P1B on P1B.id = M.j1_bis
INNER JOIN joueurs P2 on P2.id = M.j2
LEFT OUTER JOIN `joueurs` P2B on P2B.id = M.j2_bis
LEFT JOIN tennis_rankings R1 on R1.player = P1.id AND R1.id = IF(P1.sexe = 1, 'wta', 'atp')
LEFT JOIN tennis_rankings R1B on R1B.player = P1B.id AND R1B.id = IF(P1B.sexe = 1, 'wta', 'atp')
LEFT JOIN tennis_rankings R2 on R2.player = P2.id AND R2.id = IF(P2.sexe = 1, 'wta', 'atp')
LEFT JOIN tennis_rankings R2B on R2B.player = P2B.id AND R2B.id = IF(P2B.sexe = 1, 'wta', 'atp')
INNER JOIN tournois T on T.id = M.idt
INNER JOIN tournois_name N on N.id = T.id && N.cup = 0
LEFT OUTER JOIN lieux_sites SL on T.ids = SL.id
LEFT OUTER JOIN lieux_villes SC on SL.idv = SC.id
LEFT OUTER JOIN lieux_pays SCO on SCO.code = SC.pays
LEFT OUTER JOIN `livescores_new`.`matchs` LS on LS.tt_match_id = M.id
LEFT OUTER JOIN tournois_programmes S on S.idm = M.id
LEFT OUTER JOIN lieux_courts C on C.ids = S.ids && C.ordre = S.court
WHERE
M.id = '9432729'
&& M.type_tournoi_add = 0
&& (S.statut = 0 || S.statut = 4 || S.statut = 2 || ISNULL(S.statut))
UNION
SELECT
M.*
, M.time_start time_start
, M.time time_end
, M.duration_pause
, M.type_match_add type_match
, M.type_tournoi_add type_tournament
, CR.niveau level
, M.qualif
, M.idw winner_id
, P1.id p1_id
, P1.nom p1_name
, P1.prenom p1_first_name
, P1.name_zh p1_name_zh
, P1.birthday p1_birthday
, P1.sexe p1_gender
, P1.nat p1_nat
, P1.photo p1_photo
, P1.taille p1_height
, P1.poids p1_weight
, R1.rank p1_rank
, R1.liveRank p1_rank_live
, P1.pro_depuis p1_turn_pro
, '?' p1_best_rank
, P1.prise p1_forehand
, P1.revers p1_backhand
, M.ts1 p1_seed
, P1B.id p1b_id
, P1B.nom p1b_name
, P1B.prenom p1b_first_name
, P1B.name_zh p1b_name_zh
, P1B.birthday p1b_birthday
, P1B.sexe p1b_gender
, P1B.nat p1b_nat
, P1B.photo p1b_photo
, P1B.taille p1b_height
, P1B.poids p1b_weight
, R1B.rank p1b_rank
, R1B.liveRank p1b_rank_live
, P1B.pro_depuis p1b_turn_pro
, P2.id p2_id
, P2.nom p2_name
, P2.prenom p2_first_name
, P2.name_zh p2_name_zh
, P2.birthday p2_birthday
, P2.sexe p2_gender
, P2.nat p2_nat
, P2.photo p2_photo
, P2.taille p2_height
, P2.poids p2_weight
, R2.rank p2_rank
, R2.liveRank p2_rank_live
, P2.pro_depuis p2_turn_pro
, '?' p2_best_rank
, P2.prise p2_forehand
, P2.revers p2_backhand
, M.ts2 p2_seed
, P2B.id p2b_id
, P2B.nom p2b_name
, P2B.prenom p2b_first_name
, P2B.name_zh p2b_name_zh
, P2B.birthday p2b_birthday
, P2B.sexe p2b_gender
, P2B.nat p2b_nat
, P2B.photo p2b_photo
, P2B.taille p2b_height
, P2B.poids p2b_weight
, R2B.rank p2b_rank
, R2B.liveRank p2b_rank_live
, P2B.pro_depuis p2b_turn_pro
, C.id tournament_id
, C.parent tournament_idt
, CR.id rencontre_id
, N.name_fr tournament_name_fr
, N.name_en tournament_name_en
, N.name_zh tournament_name_zh
, N.name_de tournament_name_de
, N.name_es tournament_name_es
, CONCAT(CR.equipe_domicile, '|', CR.equipe_exterieur) tournament_city
, '' tournament_stadium
, CR.surface tournament_surface
, '' tournament_surface_photo
, '0' tournament_surface_color
, '' tournament_currency
, '' tournament_prize_money
, SCO.nom_fr tournament_country
, '' tournament_logo
, CR.date_d tournament_start
, '' tournament_end
, C.nbj tournament_nbPlayer
, '' tournament_genre
, '' tournament_category
, '' tournament_type
, CR.lieu tournament_site
, '' tournament_year
, 65 tournament_importance
, IF(T1.nom_fr, T1.nom_fr, CR.equipe_domicile) team1
, IF(T2.nom_fr, T1.nom_fr, CR.equipe_exterieur) team2
, 65 importance
, '' tournament_background
, SC.fuseau_horaire
, IF(ISNULL(LS.status) || M.status = 2 || M.status = 3 || M.status = 4, M.status, LS.status) match_status
, LS.serve
, S.time s_time_start
, S.court
, S.date_loc
, S.type s_type
, S.ordre s_order
, CT.nom court_name
, CT.ordre court_order
FROM
tournois_matchs M
INNER JOIN joueurs P1 on P1.id = M.j1
LEFT OUTER JOIN `joueurs` P1B on P1B.id = M.j1_bis
INNER JOIN joueurs P2 on P2.id = M.j2
LEFT OUTER JOIN `joueurs` P2B on P2B.id = M.j2_bis
LEFT JOIN tennis_rankings R1 on R1.player = P1.id AND R1.id = IF(P1.sexe = 1, 'wta', 'atp')
LEFT JOIN tennis_rankings R1B on R1B.player = P1B.id AND R1B.id = IF(P1B.sexe = 1, 'wta', 'atp')
LEFT JOIN tennis_rankings R2 on R2.player = P2.id AND R2.id = IF(P2.sexe = 1, 'wta', 'atp')
LEFT JOIN tennis_rankings R2B on R2B.player = P2B.id AND R2B.id = IF(P2B.sexe = 1, 'wta', 'atp')
LEFT OUTER JOIN `livescores_new`.`matchs` LS ON (LS.tt_match_id = M.id)
LEFT OUTER JOIN tournois_programmes S on S.idm = M.id
LEFT OUTER JOIN lieux_courts CT on (CT.ids = S.ids && CT.ordre = S.court)
INNER JOIN `coupes_rencontres` CR on CR.id = M.idt
INNER JOIN `coupes` C on C.id = CR.coupe_id
INNER JOIN tournois_name N on N.id = C.id
LEFT JOIN lieux_sites SL on SL.id = CR.lieu
LEFT JOIN lieux_villes SC on SC.id = SL.idv
LEFT JOIN lieux_pays SCO on SCO.code = SC.pays
LEFT JOIN `lieux_pays` T1 ON (T1.code = CR.equipe_domicile)
LEFT JOIN `lieux_pays` T2 ON (T2.code = CR.equipe_exterieur)
WHERE
M.id = '9432729'
&& M.type_tournoi_add = 1
&& (S.statut = 0 || S.statut = 4 || S.statut = 2 || ISNULL(S.statut))
UNION
SELECT
M.*
, M.time_start time_start
, M.time time_end
, M.duration_pause
, M.type_match_add type_match
, M.type_tournoi_add type_tournament
, '' level
, M.qualif
, M.idw winner_id
, P1.id p1_id
, P1.nom p1_name
, P1.prenom p1_first_name
, P1.name_zh p1_name_zh
, P1.birthday p1_birthday
, P1.sexe p1_gender
, P1.nat p1_nat
, P1.photo p1_photo
, P1.taille p1_height
, P1.poids p1_weight
, R1.rank p1_rank
, R1.liveRank p1_rank_live
, P1.pro_depuis p1_turn_pro
, '?' p1_best_rank
, P1.prise p1_forehand
, P1.revers p1_backhand
, M.ts1 p1_seed
, P1B.id p1b_id
, P1B.nom p1b_name
, P1B.prenom p1b_first_name
, P1B.name_zh p1b_name_zh
, P1B.birthday p1b_birthday
, P1B.sexe p1b_gender
, P1B.nat p1b_nat
, P1B.photo p1b_photo
, P1B.taille p1b_height
, P1B.poids p1b_weight
, R1B.rank p1b_rank
, R1B.liveRank p1b_rank_live
, P1B.pro_depuis p1b_turn_pro
, P2.id p2_id
, P2.nom p2_name
, P2.prenom p2_first_name
, P2.name_zh p2_name_zh
, P2.birthday p2_birthday
, P2.sexe p2_gender
, P2.nat p2_nat
, P2.photo p2_photo
, P2.taille p2_height
, P2.poids p2_weight
, R2.rank p2_rank
, R2.liveRank p2_rank_live
, P2.pro_depuis p2_turn_pro
, '?' p2_best_rank
, P2.prise p2_forehand
, P2.revers p2_backhand
, M.ts2 p2_seed
, P2B.id p2b_id
, P2B.nom p2b_name
, P2B.prenom p2b_first_name
, P2B.name_zh p2b_name_zh
, P2B.birthday p2b_birthday
, P2B.sexe p2b_gender
, P2B.nat p2b_nat
, P2B.photo p2b_photo
, P2B.taille p2b_height
, P2B.poids p2b_weight
, R2B.rank p2b_rank
, R2B.liveRank p2b_rank_live
, P2B.pro_depuis p2b_turn_pro
, L.id tournament_id
, 0 tournament_idt
, LR.id rencontre_id
, N.name_fr tournament_name_fr
, N.name_en tournament_name_en
, N.name_zh tournament_name_zh
, N.name_de tournament_name_de
, N.name_es tournament_name_es
, SC.nom tournament_city
, '' tournament_stadium
, '3' tournament_surface
, '' tournament_surface_photo
, '0' tournament_surface_color
, '' tournament_currency
, '' tournament_prize_money
, SCO.nom_fr tournament_country
, '' tournament_logo
, L.time_start tournament_start
, '' tournament_end
, '' tournament_nbPlayer
, '' tournament_genre
, '' tournament_category
, '' tournament_type
, LR.site tournament_site
, L.year tournament_year
, 0 tournament_importance
, '' team1
, '' team2
, 3 importance
, '' tournament_background
, SC.fuseau_horaire
, IF(ISNULL(LS.status) || M.status = 2 || M.status = 3 || M.status = 4, M.status, LS.status) match_status
, LS.serve
, S.time s_time_start
, S.court
, S.date_loc
, S.type s_type
, S.ordre s_order
, CT.nom court_name
, CT.ordre court_order
FROM
tournois_matchs M
JOIN joueurs P1 on P1.id = M.j1
LEFT JOIN `joueurs` P1B on P1B.id = M.j1_bis
JOIN joueurs P2 on P2.id = M.j2
LEFT JOIN `joueurs` P2B on P2B.id = M.j2_bis
LEFT JOIN tennis_rankings R1 on R1.player = P1.id AND R1.id = IF(P1.sexe = 1, 'wta', 'atp')
LEFT JOIN tennis_rankings R1B on R1B.player = P1B.id AND R1B.id = IF(P1B.sexe = 1, 'wta', 'atp')
LEFT JOIN tennis_rankings R2 on R2.player = P2.id AND R2.id = IF(P2.sexe = 1, 'wta', 'atp')
LEFT JOIN tennis_rankings R2B on R2B.player = P2B.id AND R2B.id = IF(P2B.sexe = 1, 'wta', 'atp')
LEFT JOIN `livescores_new`.`matchs` LS ON (LS.tt_match_id = M.id)
LEFT JOIN tournois_programmes S on S.idm = M.id
LEFT JOIN lieux_courts CT on (CT.ids = S.ids && CT.ordre = S.court)
JOIN `leagues_rounds` LR on LR.id = M.league_round
JOIN `leagues` L on L.id = LR.league
JOIN tournois_name N on N.league = L.id
LEFT JOIN lieux_sites SL on SL.id = LR.site
LEFT JOIN lieux_villes SC on SC.id = SL.idv
LEFT JOIN lieux_pays SCO on SCO.code = SC.pays
WHERE
M.id = '9432729'
&& M.type_tournoi_add = 2
&& (S.statut = 0 || S.statut = 4 || S.statut = 2 || ISNULL(S.statut))
LIMIT 1
SELECT M.*
, M.time_start time_start
, M.time time_end
, M.duration_pause
, M.type_match_add type_match
, M.type_tournoi_add type_tournament
, M.niveau level
, M.qualif
, M.idw winner_id
, P1.id p1_id
, P1.nom p1_name
, P1.prenom p1_first_name
, P1.name_zh p1_name_zh
, P1.birthday p1_birthday
, P1.sexe p1_gender
, P1.nat p1_nat
, P1.photo p1_photo
, P1.taille p1_height
, P1.poids p1_weight
, R1.rank p1_rank
, R1.liveRank p1_rank_live
, P1.pro_depuis p1_turn_pro
, '?' p1_best_rank
, P1.prise p1_forehand
, P1.revers p1_backhand
, M.ts1 p1_seed
, P1B.id p1b_id
, P1B.nom p1b_name
, P1B.prenom p1b_first_name
, P1B.name_zh p1b_name_zh
, P1B.birthday p1b_birthday
, P1B.sexe p1b_gender
, P1B.nat p1b_nat
, P1B.photo p1b_photo
, P1B.taille p1b_height
, P1B.poids p1b_weight
, R1B.rank p1b_rank
, R1B.liveRank p1b_rank_live
, P1B.pro_depuis p1b_turn_pro
, P2.id p2_id
, P2.nom p2_name
, P2.prenom p2_first_name
, P2.name_zh p2_name_zh
, P2.birthday p2_birthday
, P2.sexe p2_gender
, P2.nat p2_nat
, P2.photo p2_photo
, P2.taille p2_height
, P2.poids p2_weight
, R2.rank p2_rank
, R2.liveRank p2_rank_live
, P2.pro_depuis p2_turn_pro
, '?' p2_best_rank
, P2.prise p2_forehand
, P2.revers p2_backhand
, M.ts2 p2_seed
, P2B.id p2b_id
, P2B.nom p2b_name
, P2B.prenom p2b_first_name
, P2B.name_zh p2b_name_zh
, P2B.birthday p2b_birthday
, P2B.sexe p2b_gender
, P2B.nat p2b_nat
, P2B.photo p2b_photo
, P2B.taille p2b_height
, P2B.poids p2b_weight
, R2B.rank p2b_rank
, R2B.liveRank p2b_rank_live
, P2B.pro_depuis p2b_turn_pro
, T.id tournament_id
, T.idt tournament_idt
, '?' rencontre_id
, N.name_fr tournament_name_fr
, N.name_en tournament_name_en
, N.name_zh tournament_name_zh
, N.name_de tournament_name_de
, N.name_es tournament_name_es
, T.ville tournament_city
, T.stade tournament_stadium
, T.surface tournament_surface
, T.surface_photo tournament_surface_photo
, T.surface_color tournament_surface_color
, T.monnaie tournament_currency
, T.prix tournament_prize_money
, SCO.nom_fr tournament_country
, T.logo tournament_logo
, T.debut tournament_start
, T.fin tournament_end
, T.nbj tournament_nbPlayer
, T.genre tournament_genre
, T.category tournament_category
, T.type tournament_type
, T.ids tournament_site
, T.year tournament_year
, T.importance tournament_importance
, '' team1
, '' team2
, T.importance
, T.background tournament_background
, SC.fuseau_horaire
, IF(ISNULL(LS.status) || M.status = 2 || M.status = 3 || M.status = 4, M.status, LS.status) match_status
, LS.serve
, S.time s_time_start
, S.court
, S.date_loc
, S.type s_type
, S.ordre s_order
, C.nom court_name
, C.ordre court_order
FROM
tournois_matchs M
INNER JOIN joueurs P1 on P1.id = M.j1
LEFT OUTER JOIN `joueurs` P1B on P1B.id = M.j1_bis
INNER JOIN joueurs P2 on P2.id = M.j2
LEFT OUTER JOIN `joueurs` P2B on P2B.id = M.j2_bis
LEFT JOIN tennis_rankings R1 on R1.player = P1.id AND R1.id = IF(P1.sexe = 1, 'wta', 'atp')
LEFT JOIN tennis_rankings R1B on R1B.player = P1B.id AND R1B.id = IF(P1B.sexe = 1, 'wta', 'atp')
LEFT JOIN tennis_rankings R2 on R2.player = P2.id AND R2.id = IF(P2.sexe = 1, 'wta', 'atp')
LEFT JOIN tennis_rankings R2B on R2B.player = P2B.id AND R2B.id = IF(P2B.sexe = 1, 'wta', 'atp')
INNER JOIN tournois T on T.id = M.idt
INNER JOIN tournois_name N on N.id = T.id && N.cup = 0
LEFT OUTER JOIN lieux_sites SL on T.ids = SL.id
LEFT OUTER JOIN lieux_villes SC on SL.idv = SC.id
LEFT OUTER JOIN lieux_pays SCO on SCO.code = SC.pays
LEFT OUTER JOIN `livescores_new`.`matchs` LS on LS.tt_match_id = M.id
LEFT OUTER JOIN tournois_programmes S on S.idm = M.id
LEFT OUTER JOIN lieux_courts C on C.ids = S.ids && C.ordre = S.court
WHERE
M.id = '9432730'
&& M.type_tournoi_add = 0
&& (S.statut = 0 || S.statut = 4 || S.statut = 2 || ISNULL(S.statut))
UNION
SELECT
M.*
, M.time_start time_start
, M.time time_end
, M.duration_pause
, M.type_match_add type_match
, M.type_tournoi_add type_tournament
, CR.niveau level
, M.qualif
, M.idw winner_id
, P1.id p1_id
, P1.nom p1_name
, P1.prenom p1_first_name
, P1.name_zh p1_name_zh
, P1.birthday p1_birthday
, P1.sexe p1_gender
, P1.nat p1_nat
, P1.photo p1_photo
, P1.taille p1_height
, P1.poids p1_weight
, R1.rank p1_rank
, R1.liveRank p1_rank_live
, P1.pro_depuis p1_turn_pro
, '?' p1_best_rank
, P1.prise p1_forehand
, P1.revers p1_backhand
, M.ts1 p1_seed
, P1B.id p1b_id
, P1B.nom p1b_name
, P1B.prenom p1b_first_name
, P1B.name_zh p1b_name_zh
, P1B.birthday p1b_birthday
, P1B.sexe p1b_gender
, P1B.nat p1b_nat
, P1B.photo p1b_photo
, P1B.taille p1b_height
, P1B.poids p1b_weight
, R1B.rank p1b_rank
, R1B.liveRank p1b_rank_live
, P1B.pro_depuis p1b_turn_pro
, P2.id p2_id
, P2.nom p2_name
, P2.prenom p2_first_name
, P2.name_zh p2_name_zh
, P2.birthday p2_birthday
, P2.sexe p2_gender
, P2.nat p2_nat
, P2.photo p2_photo
, P2.taille p2_height
, P2.poids p2_weight
, R2.rank p2_rank
, R2.liveRank p2_rank_live
, P2.pro_depuis p2_turn_pro
, '?' p2_best_rank
, P2.prise p2_forehand
, P2.revers p2_backhand
, M.ts2 p2_seed
, P2B.id p2b_id
, P2B.nom p2b_name
, P2B.prenom p2b_first_name
, P2B.name_zh p2b_name_zh
, P2B.birthday p2b_birthday
, P2B.sexe p2b_gender
, P2B.nat p2b_nat
, P2B.photo p2b_photo
, P2B.taille p2b_height
, P2B.poids p2b_weight
, R2B.rank p2b_rank
, R2B.liveRank p2b_rank_live
, P2B.pro_depuis p2b_turn_pro
, C.id tournament_id
, C.parent tournament_idt
, CR.id rencontre_id
, N.name_fr tournament_name_fr
, N.name_en tournament_name_en
, N.name_zh tournament_name_zh
, N.name_de tournament_name_de
, N.name_es tournament_name_es
, CONCAT(CR.equipe_domicile, '|', CR.equipe_exterieur) tournament_city
, '' tournament_stadium
, CR.surface tournament_surface
, '' tournament_surface_photo
, '0' tournament_surface_color
, '' tournament_currency
, '' tournament_prize_money
, SCO.nom_fr tournament_country
, '' tournament_logo
, CR.date_d tournament_start
, '' tournament_end
, C.nbj tournament_nbPlayer
, '' tournament_genre
, '' tournament_category
, '' tournament_type
, CR.lieu tournament_site
, '' tournament_year
, 65 tournament_importance
, IF(T1.nom_fr, T1.nom_fr, CR.equipe_domicile) team1
, IF(T2.nom_fr, T1.nom_fr, CR.equipe_exterieur) team2
, 65 importance
, '' tournament_background
, SC.fuseau_horaire
, IF(ISNULL(LS.status) || M.status = 2 || M.status = 3 || M.status = 4, M.status, LS.status) match_status
, LS.serve
, S.time s_time_start
, S.court
, S.date_loc
, S.type s_type
, S.ordre s_order
, CT.nom court_name
, CT.ordre court_order
FROM
tournois_matchs M
INNER JOIN joueurs P1 on P1.id = M.j1
LEFT OUTER JOIN `joueurs` P1B on P1B.id = M.j1_bis
INNER JOIN joueurs P2 on P2.id = M.j2
LEFT OUTER JOIN `joueurs` P2B on P2B.id = M.j2_bis
LEFT JOIN tennis_rankings R1 on R1.player = P1.id AND R1.id = IF(P1.sexe = 1, 'wta', 'atp')
LEFT JOIN tennis_rankings R1B on R1B.player = P1B.id AND R1B.id = IF(P1B.sexe = 1, 'wta', 'atp')
LEFT JOIN tennis_rankings R2 on R2.player = P2.id AND R2.id = IF(P2.sexe = 1, 'wta', 'atp')
LEFT JOIN tennis_rankings R2B on R2B.player = P2B.id AND R2B.id = IF(P2B.sexe = 1, 'wta', 'atp')
LEFT OUTER JOIN `livescores_new`.`matchs` LS ON (LS.tt_match_id = M.id)
LEFT OUTER JOIN tournois_programmes S on S.idm = M.id
LEFT OUTER JOIN lieux_courts CT on (CT.ids = S.ids && CT.ordre = S.court)
INNER JOIN `coupes_rencontres` CR on CR.id = M.idt
INNER JOIN `coupes` C on C.id = CR.coupe_id
INNER JOIN tournois_name N on N.id = C.id
LEFT JOIN lieux_sites SL on SL.id = CR.lieu
LEFT JOIN lieux_villes SC on SC.id = SL.idv
LEFT JOIN lieux_pays SCO on SCO.code = SC.pays
LEFT JOIN `lieux_pays` T1 ON (T1.code = CR.equipe_domicile)
LEFT JOIN `lieux_pays` T2 ON (T2.code = CR.equipe_exterieur)
WHERE
M.id = '9432730'
&& M.type_tournoi_add = 1
&& (S.statut = 0 || S.statut = 4 || S.statut = 2 || ISNULL(S.statut))
UNION
SELECT
M.*
, M.time_start time_start
, M.time time_end
, M.duration_pause
, M.type_match_add type_match
, M.type_tournoi_add type_tournament
, '' level
, M.qualif
, M.idw winner_id
, P1.id p1_id
, P1.nom p1_name
, P1.prenom p1_first_name
, P1.name_zh p1_name_zh
, P1.birthday p1_birthday
, P1.sexe p1_gender
, P1.nat p1_nat
, P1.photo p1_photo
, P1.taille p1_height
, P1.poids p1_weight
, R1.rank p1_rank
, R1.liveRank p1_rank_live
, P1.pro_depuis p1_turn_pro
, '?' p1_best_rank
, P1.prise p1_forehand
, P1.revers p1_backhand
, M.ts1 p1_seed
, P1B.id p1b_id
, P1B.nom p1b_name
, P1B.prenom p1b_first_name
, P1B.name_zh p1b_name_zh
, P1B.birthday p1b_birthday
, P1B.sexe p1b_gender
, P1B.nat p1b_nat
, P1B.photo p1b_photo
, P1B.taille p1b_height
, P1B.poids p1b_weight
, R1B.rank p1b_rank
, R1B.liveRank p1b_rank_live
, P1B.pro_depuis p1b_turn_pro
, P2.id p2_id
, P2.nom p2_name
, P2.prenom p2_first_name
, P2.name_zh p2_name_zh
, P2.birthday p2_birthday
, P2.sexe p2_gender
, P2.nat p2_nat
, P2.photo p2_photo
, P2.taille p2_height
, P2.poids p2_weight
, R2.rank p2_rank
, R2.liveRank p2_rank_live
, P2.pro_depuis p2_turn_pro
, '?' p2_best_rank
, P2.prise p2_forehand
, P2.revers p2_backhand
, M.ts2 p2_seed
, P2B.id p2b_id
, P2B.nom p2b_name
, P2B.prenom p2b_first_name
, P2B.name_zh p2b_name_zh
, P2B.birthday p2b_birthday
, P2B.sexe p2b_gender
, P2B.nat p2b_nat
, P2B.photo p2b_photo
, P2B.taille p2b_height
, P2B.poids p2b_weight
, R2B.rank p2b_rank
, R2B.liveRank p2b_rank_live
, P2B.pro_depuis p2b_turn_pro
, L.id tournament_id
, 0 tournament_idt
, LR.id rencontre_id
, N.name_fr tournament_name_fr
, N.name_en tournament_name_en
, N.name_zh tournament_name_zh
, N.name_de tournament_name_de
, N.name_es tournament_name_es
, SC.nom tournament_city
, '' tournament_stadium
, '3' tournament_surface
, '' tournament_surface_photo
, '0' tournament_surface_color
, '' tournament_currency
, '' tournament_prize_money
, SCO.nom_fr tournament_country
, '' tournament_logo
, L.time_start tournament_start
, '' tournament_end
, '' tournament_nbPlayer
, '' tournament_genre
, '' tournament_category
, '' tournament_type
, LR.site tournament_site
, L.year tournament_year
, 0 tournament_importance
, '' team1
, '' team2
, 3 importance
, '' tournament_background
, SC.fuseau_horaire
, IF(ISNULL(LS.status) || M.status = 2 || M.status = 3 || M.status = 4, M.status, LS.status) match_status
, LS.serve
, S.time s_time_start
, S.court
, S.date_loc
, S.type s_type
, S.ordre s_order
, CT.nom court_name
, CT.ordre court_order
FROM
tournois_matchs M
JOIN joueurs P1 on P1.id = M.j1
LEFT JOIN `joueurs` P1B on P1B.id = M.j1_bis
JOIN joueurs P2 on P2.id = M.j2
LEFT JOIN `joueurs` P2B on P2B.id = M.j2_bis
LEFT JOIN tennis_rankings R1 on R1.player = P1.id AND R1.id = IF(P1.sexe = 1, 'wta', 'atp')
LEFT JOIN tennis_rankings R1B on R1B.player = P1B.id AND R1B.id = IF(P1B.sexe = 1, 'wta', 'atp')
LEFT JOIN tennis_rankings R2 on R2.player = P2.id AND R2.id = IF(P2.sexe = 1, 'wta', 'atp')
LEFT JOIN tennis_rankings R2B on R2B.player = P2B.id AND R2B.id = IF(P2B.sexe = 1, 'wta', 'atp')
LEFT JOIN `livescores_new`.`matchs` LS ON (LS.tt_match_id = M.id)
LEFT JOIN tournois_programmes S on S.idm = M.id
LEFT JOIN lieux_courts CT on (CT.ids = S.ids && CT.ordre = S.court)
JOIN `leagues_rounds` LR on LR.id = M.league_round
JOIN `leagues` L on L.id = LR.league
JOIN tournois_name N on N.league = L.id
LEFT JOIN lieux_sites SL on SL.id = LR.site
LEFT JOIN lieux_villes SC on SC.id = SL.idv
LEFT JOIN lieux_pays SCO on SCO.code = SC.pays
WHERE
M.id = '9432730'
&& M.type_tournoi_add = 2
&& (S.statut = 0 || S.statut = 4 || S.statut = 2 || ISNULL(S.statut))
LIMIT 1
SELECT M.*
, M.time_start time_start
, M.time time_end
, M.duration_pause
, M.type_match_add type_match
, M.type_tournoi_add type_tournament
, M.niveau level
, M.qualif
, M.idw winner_id
, P1.id p1_id
, P1.nom p1_name
, P1.prenom p1_first_name
, P1.name_zh p1_name_zh
, P1.birthday p1_birthday
, P1.sexe p1_gender
, P1.nat p1_nat
, P1.photo p1_photo
, P1.taille p1_height
, P1.poids p1_weight
, R1.rank p1_rank
, R1.liveRank p1_rank_live
, P1.pro_depuis p1_turn_pro
, '?' p1_best_rank
, P1.prise p1_forehand
, P1.revers p1_backhand
, M.ts1 p1_seed
, P1B.id p1b_id
, P1B.nom p1b_name
, P1B.prenom p1b_first_name
, P1B.name_zh p1b_name_zh
, P1B.birthday p1b_birthday
, P1B.sexe p1b_gender
, P1B.nat p1b_nat
, P1B.photo p1b_photo
, P1B.taille p1b_height
, P1B.poids p1b_weight
, R1B.rank p1b_rank
, R1B.liveRank p1b_rank_live
, P1B.pro_depuis p1b_turn_pro
, P2.id p2_id
, P2.nom p2_name
, P2.prenom p2_first_name
, P2.name_zh p2_name_zh
, P2.birthday p2_birthday
, P2.sexe p2_gender
, P2.nat p2_nat
, P2.photo p2_photo
, P2.taille p2_height
, P2.poids p2_weight
, R2.rank p2_rank
, R2.liveRank p2_rank_live
, P2.pro_depuis p2_turn_pro
, '?' p2_best_rank
, P2.prise p2_forehand
, P2.revers p2_backhand
, M.ts2 p2_seed
, P2B.id p2b_id
, P2B.nom p2b_name
, P2B.prenom p2b_first_name
, P2B.name_zh p2b_name_zh
, P2B.birthday p2b_birthday
, P2B.sexe p2b_gender
, P2B.nat p2b_nat
, P2B.photo p2b_photo
, P2B.taille p2b_height
, P2B.poids p2b_weight
, R2B.rank p2b_rank
, R2B.liveRank p2b_rank_live
, P2B.pro_depuis p2b_turn_pro
, T.id tournament_id
, T.idt tournament_idt
, '?' rencontre_id
, N.name_fr tournament_name_fr
, N.name_en tournament_name_en
, N.name_zh tournament_name_zh
, N.name_de tournament_name_de
, N.name_es tournament_name_es
, T.ville tournament_city
, T.stade tournament_stadium
, T.surface tournament_surface
, T.surface_photo tournament_surface_photo
, T.surface_color tournament_surface_color
, T.monnaie tournament_currency
, T.prix tournament_prize_money
, SCO.nom_fr tournament_country
, T.logo tournament_logo
, T.debut tournament_start
, T.fin tournament_end
, T.nbj tournament_nbPlayer
, T.genre tournament_genre
, T.category tournament_category
, T.type tournament_type
, T.ids tournament_site
, T.year tournament_year
, T.importance tournament_importance
, '' team1
, '' team2
, T.importance
, T.background tournament_background
, SC.fuseau_horaire
, IF(ISNULL(LS.status) || M.status = 2 || M.status = 3 || M.status = 4, M.status, LS.status) match_status
, LS.serve
, S.time s_time_start
, S.court
, S.date_loc
, S.type s_type
, S.ordre s_order
, C.nom court_name
, C.ordre court_order
FROM
tournois_matchs M
INNER JOIN joueurs P1 on P1.id = M.j1
LEFT OUTER JOIN `joueurs` P1B on P1B.id = M.j1_bis
INNER JOIN joueurs P2 on P2.id = M.j2
LEFT OUTER JOIN `joueurs` P2B on P2B.id = M.j2_bis
LEFT JOIN tennis_rankings R1 on R1.player = P1.id AND R1.id = IF(P1.sexe = 1, 'wta', 'atp')
LEFT JOIN tennis_rankings R1B on R1B.player = P1B.id AND R1B.id = IF(P1B.sexe = 1, 'wta', 'atp')
LEFT JOIN tennis_rankings R2 on R2.player = P2.id AND R2.id = IF(P2.sexe = 1, 'wta', 'atp')
LEFT JOIN tennis_rankings R2B on R2B.player = P2B.id AND R2B.id = IF(P2B.sexe = 1, 'wta', 'atp')
INNER JOIN tournois T on T.id = M.idt
INNER JOIN tournois_name N on N.id = T.id && N.cup = 0
LEFT OUTER JOIN lieux_sites SL on T.ids = SL.id
LEFT OUTER JOIN lieux_villes SC on SL.idv = SC.id
LEFT OUTER JOIN lieux_pays SCO on SCO.code = SC.pays
LEFT OUTER JOIN `livescores_new`.`matchs` LS on LS.tt_match_id = M.id
LEFT OUTER JOIN tournois_programmes S on S.idm = M.id
LEFT OUTER JOIN lieux_courts C on C.ids = S.ids && C.ordre = S.court
WHERE
M.id = '9432415'
&& M.type_tournoi_add = 0
&& (S.statut = 0 || S.statut = 4 || S.statut = 2 || ISNULL(S.statut))
UNION
SELECT
M.*
, M.time_start time_start
, M.time time_end
, M.duration_pause
, M.type_match_add type_match
, M.type_tournoi_add type_tournament
, CR.niveau level
, M.qualif
, M.idw winner_id
, P1.id p1_id
, P1.nom p1_name
, P1.prenom p1_first_name
, P1.name_zh p1_name_zh
, P1.birthday p1_birthday
, P1.sexe p1_gender
, P1.nat p1_nat
, P1.photo p1_photo
, P1.taille p1_height
, P1.poids p1_weight
, R1.rank p1_rank
, R1.liveRank p1_rank_live
, P1.pro_depuis p1_turn_pro
, '?' p1_best_rank
, P1.prise p1_forehand
, P1.revers p1_backhand
, M.ts1 p1_seed
, P1B.id p1b_id
, P1B.nom p1b_name
, P1B.prenom p1b_first_name
, P1B.name_zh p1b_name_zh
, P1B.birthday p1b_birthday
, P1B.sexe p1b_gender
, P1B.nat p1b_nat
, P1B.photo p1b_photo
, P1B.taille p1b_height
, P1B.poids p1b_weight
, R1B.rank p1b_rank
, R1B.liveRank p1b_rank_live
, P1B.pro_depuis p1b_turn_pro
, P2.id p2_id
, P2.nom p2_name
, P2.prenom p2_first_name
, P2.name_zh p2_name_zh
, P2.birthday p2_birthday
, P2.sexe p2_gender
, P2.nat p2_nat
, P2.photo p2_photo
, P2.taille p2_height
, P2.poids p2_weight
, R2.rank p2_rank
, R2.liveRank p2_rank_live
, P2.pro_depuis p2_turn_pro
, '?' p2_best_rank
, P2.prise p2_forehand
, P2.revers p2_backhand
, M.ts2 p2_seed
, P2B.id p2b_id
, P2B.nom p2b_name
, P2B.prenom p2b_first_name
, P2B.name_zh p2b_name_zh
, P2B.birthday p2b_birthday
, P2B.sexe p2b_gender
, P2B.nat p2b_nat
, P2B.photo p2b_photo
, P2B.taille p2b_height
, P2B.poids p2b_weight
, R2B.rank p2b_rank
, R2B.liveRank p2b_rank_live
, P2B.pro_depuis p2b_turn_pro
, C.id tournament_id
, C.parent tournament_idt
, CR.id rencontre_id
, N.name_fr tournament_name_fr
, N.name_en tournament_name_en
, N.name_zh tournament_name_zh
, N.name_de tournament_name_de
, N.name_es tournament_name_es
, CONCAT(CR.equipe_domicile, '|', CR.equipe_exterieur) tournament_city
, '' tournament_stadium
, CR.surface tournament_surface
, '' tournament_surface_photo
, '0' tournament_surface_color
, '' tournament_currency
, '' tournament_prize_money
, SCO.nom_fr tournament_country
, '' tournament_logo
, CR.date_d tournament_start
, '' tournament_end
, C.nbj tournament_nbPlayer
, '' tournament_genre
, '' tournament_category
, '' tournament_type
, CR.lieu tournament_site
, '' tournament_year
, 65 tournament_importance
, IF(T1.nom_fr, T1.nom_fr, CR.equipe_domicile) team1
, IF(T2.nom_fr, T1.nom_fr, CR.equipe_exterieur) team2
, 65 importance
, '' tournament_background
, SC.fuseau_horaire
, IF(ISNULL(LS.status) || M.status = 2 || M.status = 3 || M.status = 4, M.status, LS.status) match_status
, LS.serve
, S.time s_time_start
, S.court
, S.date_loc
, S.type s_type
, S.ordre s_order
, CT.nom court_name
, CT.ordre court_order
FROM
tournois_matchs M
INNER JOIN joueurs P1 on P1.id = M.j1
LEFT OUTER JOIN `joueurs` P1B on P1B.id = M.j1_bis
INNER JOIN joueurs P2 on P2.id = M.j2
LEFT OUTER JOIN `joueurs` P2B on P2B.id = M.j2_bis
LEFT JOIN tennis_rankings R1 on R1.player = P1.id AND R1.id = IF(P1.sexe = 1, 'wta', 'atp')
LEFT JOIN tennis_rankings R1B on R1B.player = P1B.id AND R1B.id = IF(P1B.sexe = 1, 'wta', 'atp')
LEFT JOIN tennis_rankings R2 on R2.player = P2.id AND R2.id = IF(P2.sexe = 1, 'wta', 'atp')
LEFT JOIN tennis_rankings R2B on R2B.player = P2B.id AND R2B.id = IF(P2B.sexe = 1, 'wta', 'atp')
LEFT OUTER JOIN `livescores_new`.`matchs` LS ON (LS.tt_match_id = M.id)
LEFT OUTER JOIN tournois_programmes S on S.idm = M.id
LEFT OUTER JOIN lieux_courts CT on (CT.ids = S.ids && CT.ordre = S.court)
INNER JOIN `coupes_rencontres` CR on CR.id = M.idt
INNER JOIN `coupes` C on C.id = CR.coupe_id
INNER JOIN tournois_name N on N.id = C.id
LEFT JOIN lieux_sites SL on SL.id = CR.lieu
LEFT JOIN lieux_villes SC on SC.id = SL.idv
LEFT JOIN lieux_pays SCO on SCO.code = SC.pays
LEFT JOIN `lieux_pays` T1 ON (T1.code = CR.equipe_domicile)
LEFT JOIN `lieux_pays` T2 ON (T2.code = CR.equipe_exterieur)
WHERE
M.id = '9432415'
&& M.type_tournoi_add = 1
&& (S.statut = 0 || S.statut = 4 || S.statut = 2 || ISNULL(S.statut))
UNION
SELECT
M.*
, M.time_start time_start
, M.time time_end
, M.duration_pause
, M.type_match_add type_match
, M.type_tournoi_add type_tournament
, '' level
, M.qualif
, M.idw winner_id
, P1.id p1_id
, P1.nom p1_name
, P1.prenom p1_first_name
, P1.name_zh p1_name_zh
, P1.birthday p1_birthday
, P1.sexe p1_gender
, P1.nat p1_nat
, P1.photo p1_photo
, P1.taille p1_height
, P1.poids p1_weight
, R1.rank p1_rank
, R1.liveRank p1_rank_live
, P1.pro_depuis p1_turn_pro
, '?' p1_best_rank
, P1.prise p1_forehand
, P1.revers p1_backhand
, M.ts1 p1_seed
, P1B.id p1b_id
, P1B.nom p1b_name
, P1B.prenom p1b_first_name
, P1B.name_zh p1b_name_zh
, P1B.birthday p1b_birthday
, P1B.sexe p1b_gender
, P1B.nat p1b_nat
, P1B.photo p1b_photo
, P1B.taille p1b_height
, P1B.poids p1b_weight
, R1B.rank p1b_rank
, R1B.liveRank p1b_rank_live
, P1B.pro_depuis p1b_turn_pro
, P2.id p2_id
, P2.nom p2_name
, P2.prenom p2_first_name
, P2.name_zh p2_name_zh
, P2.birthday p2_birthday
, P2.sexe p2_gender
, P2.nat p2_nat
, P2.photo p2_photo
, P2.taille p2_height
, P2.poids p2_weight
, R2.rank p2_rank
, R2.liveRank p2_rank_live
, P2.pro_depuis p2_turn_pro
, '?' p2_best_rank
, P2.prise p2_forehand
, P2.revers p2_backhand
, M.ts2 p2_seed
, P2B.id p2b_id
, P2B.nom p2b_name
, P2B.prenom p2b_first_name
, P2B.name_zh p2b_name_zh
, P2B.birthday p2b_birthday
, P2B.sexe p2b_gender
, P2B.nat p2b_nat
, P2B.photo p2b_photo
, P2B.taille p2b_height
, P2B.poids p2b_weight
, R2B.rank p2b_rank
, R2B.liveRank p2b_rank_live
, P2B.pro_depuis p2b_turn_pro
, L.id tournament_id
, 0 tournament_idt
, LR.id rencontre_id
, N.name_fr tournament_name_fr
, N.name_en tournament_name_en
, N.name_zh tournament_name_zh
, N.name_de tournament_name_de
, N.name_es tournament_name_es
, SC.nom tournament_city
, '' tournament_stadium
, '3' tournament_surface
, '' tournament_surface_photo
, '0' tournament_surface_color
, '' tournament_currency
, '' tournament_prize_money
, SCO.nom_fr tournament_country
, '' tournament_logo
, L.time_start tournament_start
, '' tournament_end
, '' tournament_nbPlayer
, '' tournament_genre
, '' tournament_category
, '' tournament_type
, LR.site tournament_site
, L.year tournament_year
, 0 tournament_importance
, '' team1
, '' team2
, 3 importance
, '' tournament_background
, SC.fuseau_horaire
, IF(ISNULL(LS.status) || M.status = 2 || M.status = 3 || M.status = 4, M.status, LS.status) match_status
, LS.serve
, S.time s_time_start
, S.court
, S.date_loc
, S.type s_type
, S.ordre s_order
, CT.nom court_name
, CT.ordre court_order
FROM
tournois_matchs M
JOIN joueurs P1 on P1.id = M.j1
LEFT JOIN `joueurs` P1B on P1B.id = M.j1_bis
JOIN joueurs P2 on P2.id = M.j2
LEFT JOIN `joueurs` P2B on P2B.id = M.j2_bis
LEFT JOIN tennis_rankings R1 on R1.player = P1.id AND R1.id = IF(P1.sexe = 1, 'wta', 'atp')
LEFT JOIN tennis_rankings R1B on R1B.player = P1B.id AND R1B.id = IF(P1B.sexe = 1, 'wta', 'atp')
LEFT JOIN tennis_rankings R2 on R2.player = P2.id AND R2.id = IF(P2.sexe = 1, 'wta', 'atp')
LEFT JOIN tennis_rankings R2B on R2B.player = P2B.id AND R2B.id = IF(P2B.sexe = 1, 'wta', 'atp')
LEFT JOIN `livescores_new`.`matchs` LS ON (LS.tt_match_id = M.id)
LEFT JOIN tournois_programmes S on S.idm = M.id
LEFT JOIN lieux_courts CT on (CT.ids = S.ids && CT.ordre = S.court)
JOIN `leagues_rounds` LR on LR.id = M.league_round
JOIN `leagues` L on L.id = LR.league
JOIN tournois_name N on N.league = L.id
LEFT JOIN lieux_sites SL on SL.id = LR.site
LEFT JOIN lieux_villes SC on SC.id = SL.idv
LEFT JOIN lieux_pays SCO on SCO.code = SC.pays
WHERE
M.id = '9432415'
&& M.type_tournoi_add = 2
&& (S.statut = 0 || S.statut = 4 || S.statut = 2 || ISNULL(S.statut))
LIMIT 1
SELECT M.*
, M.time_start time_start
, M.time time_end
, M.duration_pause
, M.type_match_add type_match
, M.type_tournoi_add type_tournament
, M.niveau level
, M.qualif
, M.idw winner_id
, P1.id p1_id
, P1.nom p1_name
, P1.prenom p1_first_name
, P1.name_zh p1_name_zh
, P1.birthday p1_birthday
, P1.sexe p1_gender
, P1.nat p1_nat
, P1.photo p1_photo
, P1.taille p1_height
, P1.poids p1_weight
, R1.rank p1_rank
, R1.liveRank p1_rank_live
, P1.pro_depuis p1_turn_pro
, '?' p1_best_rank
, P1.prise p1_forehand
, P1.revers p1_backhand
, M.ts1 p1_seed
, P1B.id p1b_id
, P1B.nom p1b_name
, P1B.prenom p1b_first_name
, P1B.name_zh p1b_name_zh
, P1B.birthday p1b_birthday
, P1B.sexe p1b_gender
, P1B.nat p1b_nat
, P1B.photo p1b_photo
, P1B.taille p1b_height
, P1B.poids p1b_weight
, R1B.rank p1b_rank
, R1B.liveRank p1b_rank_live
, P1B.pro_depuis p1b_turn_pro
, P2.id p2_id
, P2.nom p2_name
, P2.prenom p2_first_name
, P2.name_zh p2_name_zh
, P2.birthday p2_birthday
, P2.sexe p2_gender
, P2.nat p2_nat
, P2.photo p2_photo
, P2.taille p2_height
, P2.poids p2_weight
, R2.rank p2_rank
, R2.liveRank p2_rank_live
, P2.pro_depuis p2_turn_pro
, '?' p2_best_rank
, P2.prise p2_forehand
, P2.revers p2_backhand
, M.ts2 p2_seed
, P2B.id p2b_id
, P2B.nom p2b_name
, P2B.prenom p2b_first_name
, P2B.name_zh p2b_name_zh
, P2B.birthday p2b_birthday
, P2B.sexe p2b_gender
, P2B.nat p2b_nat
, P2B.photo p2b_photo
, P2B.taille p2b_height
, P2B.poids p2b_weight
, R2B.rank p2b_rank
, R2B.liveRank p2b_rank_live
, P2B.pro_depuis p2b_turn_pro
, T.id tournament_id
, T.idt tournament_idt
, '?' rencontre_id
, N.name_fr tournament_name_fr
, N.name_en tournament_name_en
, N.name_zh tournament_name_zh
, N.name_de tournament_name_de
, N.name_es tournament_name_es
, T.ville tournament_city
, T.stade tournament_stadium
, T.surface tournament_surface
, T.surface_photo tournament_surface_photo
, T.surface_color tournament_surface_color
, T.monnaie tournament_currency
, T.prix tournament_prize_money
, SCO.nom_fr tournament_country
, T.logo tournament_logo
, T.debut tournament_start
, T.fin tournament_end
, T.nbj tournament_nbPlayer
, T.genre tournament_genre
, T.category tournament_category
, T.type tournament_type
, T.ids tournament_site
, T.year tournament_year
, T.importance tournament_importance
, '' team1
, '' team2
, T.importance
, T.background tournament_background
, SC.fuseau_horaire
, IF(ISNULL(LS.status) || M.status = 2 || M.status = 3 || M.status = 4, M.status, LS.status) match_status
, LS.serve
, S.time s_time_start
, S.court
, S.date_loc
, S.type s_type
, S.ordre s_order
, C.nom court_name
, C.ordre court_order
FROM
tournois_matchs M
INNER JOIN joueurs P1 on P1.id = M.j1
LEFT OUTER JOIN `joueurs` P1B on P1B.id = M.j1_bis
INNER JOIN joueurs P2 on P2.id = M.j2
LEFT OUTER JOIN `joueurs` P2B on P2B.id = M.j2_bis
LEFT JOIN tennis_rankings R1 on R1.player = P1.id AND R1.id = IF(P1.sexe = 1, 'wta', 'atp')
LEFT JOIN tennis_rankings R1B on R1B.player = P1B.id AND R1B.id = IF(P1B.sexe = 1, 'wta', 'atp')
LEFT JOIN tennis_rankings R2 on R2.player = P2.id AND R2.id = IF(P2.sexe = 1, 'wta', 'atp')
LEFT JOIN tennis_rankings R2B on R2B.player = P2B.id AND R2B.id = IF(P2B.sexe = 1, 'wta', 'atp')
INNER JOIN tournois T on T.id = M.idt
INNER JOIN tournois_name N on N.id = T.id && N.cup = 0
LEFT OUTER JOIN lieux_sites SL on T.ids = SL.id
LEFT OUTER JOIN lieux_villes SC on SL.idv = SC.id
LEFT OUTER JOIN lieux_pays SCO on SCO.code = SC.pays
LEFT OUTER JOIN `livescores_new`.`matchs` LS on LS.tt_match_id = M.id
LEFT OUTER JOIN tournois_programmes S on S.idm = M.id
LEFT OUTER JOIN lieux_courts C on C.ids = S.ids && C.ordre = S.court
WHERE
M.id = '9432106'
&& M.type_tournoi_add = 0
&& (S.statut = 0 || S.statut = 4 || S.statut = 2 || ISNULL(S.statut))
UNION
SELECT
M.*
, M.time_start time_start
, M.time time_end
, M.duration_pause
, M.type_match_add type_match
, M.type_tournoi_add type_tournament
, CR.niveau level
, M.qualif
, M.idw winner_id
, P1.id p1_id
, P1.nom p1_name
, P1.prenom p1_first_name
, P1.name_zh p1_name_zh
, P1.birthday p1_birthday
, P1.sexe p1_gender
, P1.nat p1_nat
, P1.photo p1_photo
, P1.taille p1_height
, P1.poids p1_weight
, R1.rank p1_rank
, R1.liveRank p1_rank_live
, P1.pro_depuis p1_turn_pro
, '?' p1_best_rank
, P1.prise p1_forehand
, P1.revers p1_backhand
, M.ts1 p1_seed
, P1B.id p1b_id
, P1B.nom p1b_name
, P1B.prenom p1b_first_name
, P1B.name_zh p1b_name_zh
, P1B.birthday p1b_birthday
, P1B.sexe p1b_gender
, P1B.nat p1b_nat
, P1B.photo p1b_photo
, P1B.taille p1b_height
, P1B.poids p1b_weight
, R1B.rank p1b_rank
, R1B.liveRank p1b_rank_live
, P1B.pro_depuis p1b_turn_pro
, P2.id p2_id
, P2.nom p2_name
, P2.prenom p2_first_name
, P2.name_zh p2_name_zh
, P2.birthday p2_birthday
, P2.sexe p2_gender
, P2.nat p2_nat
, P2.photo p2_photo
, P2.taille p2_height
, P2.poids p2_weight
, R2.rank p2_rank
, R2.liveRank p2_rank_live
, P2.pro_depuis p2_turn_pro
, '?' p2_best_rank
, P2.prise p2_forehand
, P2.revers p2_backhand
, M.ts2 p2_seed
, P2B.id p2b_id
, P2B.nom p2b_name
, P2B.prenom p2b_first_name
, P2B.name_zh p2b_name_zh
, P2B.birthday p2b_birthday
, P2B.sexe p2b_gender
, P2B.nat p2b_nat
, P2B.photo p2b_photo
, P2B.taille p2b_height
, P2B.poids p2b_weight
, R2B.rank p2b_rank
, R2B.liveRank p2b_rank_live
, P2B.pro_depuis p2b_turn_pro
, C.id tournament_id
, C.parent tournament_idt
, CR.id rencontre_id
, N.name_fr tournament_name_fr
, N.name_en tournament_name_en
, N.name_zh tournament_name_zh
, N.name_de tournament_name_de
, N.name_es tournament_name_es
, CONCAT(CR.equipe_domicile, '|', CR.equipe_exterieur) tournament_city
, '' tournament_stadium
, CR.surface tournament_surface
, '' tournament_surface_photo
, '0' tournament_surface_color
, '' tournament_currency
, '' tournament_prize_money
, SCO.nom_fr tournament_country
, '' tournament_logo
, CR.date_d tournament_start
, '' tournament_end
, C.nbj tournament_nbPlayer
, '' tournament_genre
, '' tournament_category
, '' tournament_type
, CR.lieu tournament_site
, '' tournament_year
, 65 tournament_importance
, IF(T1.nom_fr, T1.nom_fr, CR.equipe_domicile) team1
, IF(T2.nom_fr, T1.nom_fr, CR.equipe_exterieur) team2
, 65 importance
, '' tournament_background
, SC.fuseau_horaire
, IF(ISNULL(LS.status) || M.status = 2 || M.status = 3 || M.status = 4, M.status, LS.status) match_status
, LS.serve
, S.time s_time_start
, S.court
, S.date_loc
, S.type s_type
, S.ordre s_order
, CT.nom court_name
, CT.ordre court_order
FROM
tournois_matchs M
INNER JOIN joueurs P1 on P1.id = M.j1
LEFT OUTER JOIN `joueurs` P1B on P1B.id = M.j1_bis
INNER JOIN joueurs P2 on P2.id = M.j2
LEFT OUTER JOIN `joueurs` P2B on P2B.id = M.j2_bis
LEFT JOIN tennis_rankings R1 on R1.player = P1.id AND R1.id = IF(P1.sexe = 1, 'wta', 'atp')
LEFT JOIN tennis_rankings R1B on R1B.player = P1B.id AND R1B.id = IF(P1B.sexe = 1, 'wta', 'atp')
LEFT JOIN tennis_rankings R2 on R2.player = P2.id AND R2.id = IF(P2.sexe = 1, 'wta', 'atp')
LEFT JOIN tennis_rankings R2B on R2B.player = P2B.id AND R2B.id = IF(P2B.sexe = 1, 'wta', 'atp')
LEFT OUTER JOIN `livescores_new`.`matchs` LS ON (LS.tt_match_id = M.id)
LEFT OUTER JOIN tournois_programmes S on S.idm = M.id
LEFT OUTER JOIN lieux_courts CT on (CT.ids = S.ids && CT.ordre = S.court)
INNER JOIN `coupes_rencontres` CR on CR.id = M.idt
INNER JOIN `coupes` C on C.id = CR.coupe_id
INNER JOIN tournois_name N on N.id = C.id
LEFT JOIN lieux_sites SL on SL.id = CR.lieu
LEFT JOIN lieux_villes SC on SC.id = SL.idv
LEFT JOIN lieux_pays SCO on SCO.code = SC.pays
LEFT JOIN `lieux_pays` T1 ON (T1.code = CR.equipe_domicile)
LEFT JOIN `lieux_pays` T2 ON (T2.code = CR.equipe_exterieur)
WHERE
M.id = '9432106'
&& M.type_tournoi_add = 1
&& (S.statut = 0 || S.statut = 4 || S.statut = 2 || ISNULL(S.statut))
UNION
SELECT
M.*
, M.time_start time_start
, M.time time_end
, M.duration_pause
, M.type_match_add type_match
, M.type_tournoi_add type_tournament
, '' level
, M.qualif
, M.idw winner_id
, P1.id p1_id
, P1.nom p1_name
, P1.prenom p1_first_name
, P1.name_zh p1_name_zh
, P1.birthday p1_birthday
, P1.sexe p1_gender
, P1.nat p1_nat
, P1.photo p1_photo
, P1.taille p1_height
, P1.poids p1_weight
, R1.rank p1_rank
, R1.liveRank p1_rank_live
, P1.pro_depuis p1_turn_pro
, '?' p1_best_rank
, P1.prise p1_forehand
, P1.revers p1_backhand
, M.ts1 p1_seed
, P1B.id p1b_id
, P1B.nom p1b_name
, P1B.prenom p1b_first_name
, P1B.name_zh p1b_name_zh
, P1B.birthday p1b_birthday
, P1B.sexe p1b_gender
, P1B.nat p1b_nat
, P1B.photo p1b_photo
, P1B.taille p1b_height
, P1B.poids p1b_weight
, R1B.rank p1b_rank
, R1B.liveRank p1b_rank_live
, P1B.pro_depuis p1b_turn_pro
, P2.id p2_id
, P2.nom p2_name
, P2.prenom p2_first_name
, P2.name_zh p2_name_zh
, P2.birthday p2_birthday
, P2.sexe p2_gender
, P2.nat p2_nat
, P2.photo p2_photo
, P2.taille p2_height
, P2.poids p2_weight
, R2.rank p2_rank
, R2.liveRank p2_rank_live
, P2.pro_depuis p2_turn_pro
, '?' p2_best_rank
, P2.prise p2_forehand
, P2.revers p2_backhand
, M.ts2 p2_seed
, P2B.id p2b_id
, P2B.nom p2b_name
, P2B.prenom p2b_first_name
, P2B.name_zh p2b_name_zh
, P2B.birthday p2b_birthday
, P2B.sexe p2b_gender
, P2B.nat p2b_nat
, P2B.photo p2b_photo
, P2B.taille p2b_height
, P2B.poids p2b_weight
, R2B.rank p2b_rank
, R2B.liveRank p2b_rank_live
, P2B.pro_depuis p2b_turn_pro
, L.id tournament_id
, 0 tournament_idt
, LR.id rencontre_id
, N.name_fr tournament_name_fr
, N.name_en tournament_name_en
, N.name_zh tournament_name_zh
, N.name_de tournament_name_de
, N.name_es tournament_name_es
, SC.nom tournament_city
, '' tournament_stadium
, '3' tournament_surface
, '' tournament_surface_photo
, '0' tournament_surface_color
, '' tournament_currency
, '' tournament_prize_money
, SCO.nom_fr tournament_country
, '' tournament_logo
, L.time_start tournament_start
, '' tournament_end
, '' tournament_nbPlayer
, '' tournament_genre
, '' tournament_category
, '' tournament_type
, LR.site tournament_site
, L.year tournament_year
, 0 tournament_importance
, '' team1
, '' team2
, 3 importance
, '' tournament_background
, SC.fuseau_horaire
, IF(ISNULL(LS.status) || M.status = 2 || M.status = 3 || M.status = 4, M.status, LS.status) match_status
, LS.serve
, S.time s_time_start
, S.court
, S.date_loc
, S.type s_type
, S.ordre s_order
, CT.nom court_name
, CT.ordre court_order
FROM
tournois_matchs M
JOIN joueurs P1 on P1.id = M.j1
LEFT JOIN `joueurs` P1B on P1B.id = M.j1_bis
JOIN joueurs P2 on P2.id = M.j2
LEFT JOIN `joueurs` P2B on P2B.id = M.j2_bis
LEFT JOIN tennis_rankings R1 on R1.player = P1.id AND R1.id = IF(P1.sexe = 1, 'wta', 'atp')
LEFT JOIN tennis_rankings R1B on R1B.player = P1B.id AND R1B.id = IF(P1B.sexe = 1, 'wta', 'atp')
LEFT JOIN tennis_rankings R2 on R2.player = P2.id AND R2.id = IF(P2.sexe = 1, 'wta', 'atp')
LEFT JOIN tennis_rankings R2B on R2B.player = P2B.id AND R2B.id = IF(P2B.sexe = 1, 'wta', 'atp')
LEFT JOIN `livescores_new`.`matchs` LS ON (LS.tt_match_id = M.id)
LEFT JOIN tournois_programmes S on S.idm = M.id
LEFT JOIN lieux_courts CT on (CT.ids = S.ids && CT.ordre = S.court)
JOIN `leagues_rounds` LR on LR.id = M.league_round
JOIN `leagues` L on L.id = LR.league
JOIN tournois_name N on N.league = L.id
LEFT JOIN lieux_sites SL on SL.id = LR.site
LEFT JOIN lieux_villes SC on SC.id = SL.idv
LEFT JOIN lieux_pays SCO on SCO.code = SC.pays
WHERE
M.id = '9432106'
&& M.type_tournoi_add = 2
&& (S.statut = 0 || S.statut = 4 || S.statut = 2 || ISNULL(S.statut))
LIMIT 1
SELECT M.*
, M.time_start time_start
, M.time time_end
, M.duration_pause
, M.type_match_add type_match
, M.type_tournoi_add type_tournament
, M.niveau level
, M.qualif
, M.idw winner_id
, P1.id p1_id
, P1.nom p1_name
, P1.prenom p1_first_name
, P1.name_zh p1_name_zh
, P1.birthday p1_birthday
, P1.sexe p1_gender
, P1.nat p1_nat
, P1.photo p1_photo
, P1.taille p1_height
, P1.poids p1_weight
, R1.rank p1_rank
, R1.liveRank p1_rank_live
, P1.pro_depuis p1_turn_pro
, '?' p1_best_rank
, P1.prise p1_forehand
, P1.revers p1_backhand
, M.ts1 p1_seed
, P1B.id p1b_id
, P1B.nom p1b_name
, P1B.prenom p1b_first_name
, P1B.name_zh p1b_name_zh
, P1B.birthday p1b_birthday
, P1B.sexe p1b_gender
, P1B.nat p1b_nat
, P1B.photo p1b_photo
, P1B.taille p1b_height
, P1B.poids p1b_weight
, R1B.rank p1b_rank
, R1B.liveRank p1b_rank_live
, P1B.pro_depuis p1b_turn_pro
, P2.id p2_id
, P2.nom p2_name
, P2.prenom p2_first_name
, P2.name_zh p2_name_zh
, P2.birthday p2_birthday
, P2.sexe p2_gender
, P2.nat p2_nat
, P2.photo p2_photo
, P2.taille p2_height
, P2.poids p2_weight
, R2.rank p2_rank
, R2.liveRank p2_rank_live
, P2.pro_depuis p2_turn_pro
, '?' p2_best_rank
, P2.prise p2_forehand
, P2.revers p2_backhand
, M.ts2 p2_seed
, P2B.id p2b_id
, P2B.nom p2b_name
, P2B.prenom p2b_first_name
, P2B.name_zh p2b_name_zh
, P2B.birthday p2b_birthday
, P2B.sexe p2b_gender
, P2B.nat p2b_nat
, P2B.photo p2b_photo
, P2B.taille p2b_height
, P2B.poids p2b_weight
, R2B.rank p2b_rank
, R2B.liveRank p2b_rank_live
, P2B.pro_depuis p2b_turn_pro
, T.id tournament_id
, T.idt tournament_idt
, '?' rencontre_id
, N.name_fr tournament_name_fr
, N.name_en tournament_name_en
, N.name_zh tournament_name_zh
, N.name_de tournament_name_de
, N.name_es tournament_name_es
, T.ville tournament_city
, T.stade tournament_stadium
, T.surface tournament_surface
, T.surface_photo tournament_surface_photo
, T.surface_color tournament_surface_color
, T.monnaie tournament_currency
, T.prix tournament_prize_money
, SCO.nom_fr tournament_country
, T.logo tournament_logo
, T.debut tournament_start
, T.fin tournament_end
, T.nbj tournament_nbPlayer
, T.genre tournament_genre
, T.category tournament_category
, T.type tournament_type
, T.ids tournament_site
, T.year tournament_year
, T.importance tournament_importance
, '' team1
, '' team2
, T.importance
, T.background tournament_background
, SC.fuseau_horaire
, IF(ISNULL(LS.status) || M.status = 2 || M.status = 3 || M.status = 4, M.status, LS.status) match_status
, LS.serve
, S.time s_time_start
, S.court
, S.date_loc
, S.type s_type
, S.ordre s_order
, C.nom court_name
, C.ordre court_order
FROM
tournois_matchs M
INNER JOIN joueurs P1 on P1.id = M.j1
LEFT OUTER JOIN `joueurs` P1B on P1B.id = M.j1_bis
INNER JOIN joueurs P2 on P2.id = M.j2
LEFT OUTER JOIN `joueurs` P2B on P2B.id = M.j2_bis
LEFT JOIN tennis_rankings R1 on R1.player = P1.id AND R1.id = IF(P1.sexe = 1, 'wta', 'atp')
LEFT JOIN tennis_rankings R1B on R1B.player = P1B.id AND R1B.id = IF(P1B.sexe = 1, 'wta', 'atp')
LEFT JOIN tennis_rankings R2 on R2.player = P2.id AND R2.id = IF(P2.sexe = 1, 'wta', 'atp')
LEFT JOIN tennis_rankings R2B on R2B.player = P2B.id AND R2B.id = IF(P2B.sexe = 1, 'wta', 'atp')
INNER JOIN tournois T on T.id = M.idt
INNER JOIN tournois_name N on N.id = T.id && N.cup = 0
LEFT OUTER JOIN lieux_sites SL on T.ids = SL.id
LEFT OUTER JOIN lieux_villes SC on SL.idv = SC.id
LEFT OUTER JOIN lieux_pays SCO on SCO.code = SC.pays
LEFT OUTER JOIN `livescores_new`.`matchs` LS on LS.tt_match_id = M.id
LEFT OUTER JOIN tournois_programmes S on S.idm = M.id
LEFT OUTER JOIN lieux_courts C on C.ids = S.ids && C.ordre = S.court
WHERE
M.id = '9432098'
&& M.type_tournoi_add = 0
&& (S.statut = 0 || S.statut = 4 || S.statut = 2 || ISNULL(S.statut))
UNION
SELECT
M.*
, M.time_start time_start
, M.time time_end
, M.duration_pause
, M.type_match_add type_match
, M.type_tournoi_add type_tournament
, CR.niveau level
, M.qualif
, M.idw winner_id
, P1.id p1_id
, P1.nom p1_name
, P1.prenom p1_first_name
, P1.name_zh p1_name_zh
, P1.birthday p1_birthday
, P1.sexe p1_gender
, P1.nat p1_nat
, P1.photo p1_photo
, P1.taille p1_height
, P1.poids p1_weight
, R1.rank p1_rank
, R1.liveRank p1_rank_live
, P1.pro_depuis p1_turn_pro
, '?' p1_best_rank
, P1.prise p1_forehand
, P1.revers p1_backhand
, M.ts1 p1_seed
, P1B.id p1b_id
, P1B.nom p1b_name
, P1B.prenom p1b_first_name
, P1B.name_zh p1b_name_zh
, P1B.birthday p1b_birthday
, P1B.sexe p1b_gender
, P1B.nat p1b_nat
, P1B.photo p1b_photo
, P1B.taille p1b_height
, P1B.poids p1b_weight
, R1B.rank p1b_rank
, R1B.liveRank p1b_rank_live
, P1B.pro_depuis p1b_turn_pro
, P2.id p2_id
, P2.nom p2_name
, P2.prenom p2_first_name
, P2.name_zh p2_name_zh
, P2.birthday p2_birthday
, P2.sexe p2_gender
, P2.nat p2_nat
, P2.photo p2_photo
, P2.taille p2_height
, P2.poids p2_weight
, R2.rank p2_rank
, R2.liveRank p2_rank_live
, P2.pro_depuis p2_turn_pro
, '?' p2_best_rank
, P2.prise p2_forehand
, P2.revers p2_backhand
, M.ts2 p2_seed
, P2B.id p2b_id
, P2B.nom p2b_name
, P2B.prenom p2b_first_name
, P2B.name_zh p2b_name_zh
, P2B.birthday p2b_birthday
, P2B.sexe p2b_gender
, P2B.nat p2b_nat
, P2B.photo p2b_photo
, P2B.taille p2b_height
, P2B.poids p2b_weight
, R2B.rank p2b_rank
, R2B.liveRank p2b_rank_live
, P2B.pro_depuis p2b_turn_pro
, C.id tournament_id
, C.parent tournament_idt
, CR.id rencontre_id
, N.name_fr tournament_name_fr
, N.name_en tournament_name_en
, N.name_zh tournament_name_zh
, N.name_de tournament_name_de
, N.name_es tournament_name_es
, CONCAT(CR.equipe_domicile, '|', CR.equipe_exterieur) tournament_city
, '' tournament_stadium
, CR.surface tournament_surface
, '' tournament_surface_photo
, '0' tournament_surface_color
, '' tournament_currency
, '' tournament_prize_money
, SCO.nom_fr tournament_country
, '' tournament_logo
, CR.date_d tournament_start
, '' tournament_end
, C.nbj tournament_nbPlayer
, '' tournament_genre
, '' tournament_category
, '' tournament_type
, CR.lieu tournament_site
, '' tournament_year
, 65 tournament_importance
, IF(T1.nom_fr, T1.nom_fr, CR.equipe_domicile) team1
, IF(T2.nom_fr, T1.nom_fr, CR.equipe_exterieur) team2
, 65 importance
, '' tournament_background
, SC.fuseau_horaire
, IF(ISNULL(LS.status) || M.status = 2 || M.status = 3 || M.status = 4, M.status, LS.status) match_status
, LS.serve
, S.time s_time_start
, S.court
, S.date_loc
, S.type s_type
, S.ordre s_order
, CT.nom court_name
, CT.ordre court_order
FROM
tournois_matchs M
INNER JOIN joueurs P1 on P1.id = M.j1
LEFT OUTER JOIN `joueurs` P1B on P1B.id = M.j1_bis
INNER JOIN joueurs P2 on P2.id = M.j2
LEFT OUTER JOIN `joueurs` P2B on P2B.id = M.j2_bis
LEFT JOIN tennis_rankings R1 on R1.player = P1.id AND R1.id = IF(P1.sexe = 1, 'wta', 'atp')
LEFT JOIN tennis_rankings R1B on R1B.player = P1B.id AND R1B.id = IF(P1B.sexe = 1, 'wta', 'atp')
LEFT JOIN tennis_rankings R2 on R2.player = P2.id AND R2.id = IF(P2.sexe = 1, 'wta', 'atp')
LEFT JOIN tennis_rankings R2B on R2B.player = P2B.id AND R2B.id = IF(P2B.sexe = 1, 'wta', 'atp')
LEFT OUTER JOIN `livescores_new`.`matchs` LS ON (LS.tt_match_id = M.id)
LEFT OUTER JOIN tournois_programmes S on S.idm = M.id
LEFT OUTER JOIN lieux_courts CT on (CT.ids = S.ids && CT.ordre = S.court)
INNER JOIN `coupes_rencontres` CR on CR.id = M.idt
INNER JOIN `coupes` C on C.id = CR.coupe_id
INNER JOIN tournois_name N on N.id = C.id
LEFT JOIN lieux_sites SL on SL.id = CR.lieu
LEFT JOIN lieux_villes SC on SC.id = SL.idv
LEFT JOIN lieux_pays SCO on SCO.code = SC.pays
LEFT JOIN `lieux_pays` T1 ON (T1.code = CR.equipe_domicile)
LEFT JOIN `lieux_pays` T2 ON (T2.code = CR.equipe_exterieur)
WHERE
M.id = '9432098'
&& M.type_tournoi_add = 1
&& (S.statut = 0 || S.statut = 4 || S.statut = 2 || ISNULL(S.statut))
UNION
SELECT
M.*
, M.time_start time_start
, M.time time_end
, M.duration_pause
, M.type_match_add type_match
, M.type_tournoi_add type_tournament
, '' level
, M.qualif
, M.idw winner_id
, P1.id p1_id
, P1.nom p1_name
, P1.prenom p1_first_name
, P1.name_zh p1_name_zh
, P1.birthday p1_birthday
, P1.sexe p1_gender
, P1.nat p1_nat
, P1.photo p1_photo
, P1.taille p1_height
, P1.poids p1_weight
, R1.rank p1_rank
, R1.liveRank p1_rank_live
, P1.pro_depuis p1_turn_pro
, '?' p1_best_rank
, P1.prise p1_forehand
, P1.revers p1_backhand
, M.ts1 p1_seed
, P1B.id p1b_id
, P1B.nom p1b_name
, P1B.prenom p1b_first_name
, P1B.name_zh p1b_name_zh
, P1B.birthday p1b_birthday
, P1B.sexe p1b_gender
, P1B.nat p1b_nat
, P1B.photo p1b_photo
, P1B.taille p1b_height
, P1B.poids p1b_weight
, R1B.rank p1b_rank
, R1B.liveRank p1b_rank_live
, P1B.pro_depuis p1b_turn_pro
, P2.id p2_id
, P2.nom p2_name
, P2.prenom p2_first_name
, P2.name_zh p2_name_zh
, P2.birthday p2_birthday
, P2.sexe p2_gender
, P2.nat p2_nat
, P2.photo p2_photo
, P2.taille p2_height
, P2.poids p2_weight
, R2.rank p2_rank
, R2.liveRank p2_rank_live
, P2.pro_depuis p2_turn_pro
, '?' p2_best_rank
, P2.prise p2_forehand
, P2.revers p2_backhand
, M.ts2 p2_seed
, P2B.id p2b_id
, P2B.nom p2b_name
, P2B.prenom p2b_first_name
, P2B.name_zh p2b_name_zh
, P2B.birthday p2b_birthday
, P2B.sexe p2b_gender
, P2B.nat p2b_nat
, P2B.photo p2b_photo
, P2B.taille p2b_height
, P2B.poids p2b_weight
, R2B.rank p2b_rank
, R2B.liveRank p2b_rank_live
, P2B.pro_depuis p2b_turn_pro
, L.id tournament_id
, 0 tournament_idt
, LR.id rencontre_id
, N.name_fr tournament_name_fr
, N.name_en tournament_name_en
, N.name_zh tournament_name_zh
, N.name_de tournament_name_de
, N.name_es tournament_name_es
, SC.nom tournament_city
, '' tournament_stadium
, '3' tournament_surface
, '' tournament_surface_photo
, '0' tournament_surface_color
, '' tournament_currency
, '' tournament_prize_money
, SCO.nom_fr tournament_country
, '' tournament_logo
, L.time_start tournament_start
, '' tournament_end
, '' tournament_nbPlayer
, '' tournament_genre
, '' tournament_category
, '' tournament_type
, LR.site tournament_site
, L.year tournament_year
, 0 tournament_importance
, '' team1
, '' team2
, 3 importance
, '' tournament_background
, SC.fuseau_horaire
, IF(ISNULL(LS.status) || M.status = 2 || M.status = 3 || M.status = 4, M.status, LS.status) match_status
, LS.serve
, S.time s_time_start
, S.court
, S.date_loc
, S.type s_type
, S.ordre s_order
, CT.nom court_name
, CT.ordre court_order
FROM
tournois_matchs M
JOIN joueurs P1 on P1.id = M.j1
LEFT JOIN `joueurs` P1B on P1B.id = M.j1_bis
JOIN joueurs P2 on P2.id = M.j2
LEFT JOIN `joueurs` P2B on P2B.id = M.j2_bis
LEFT JOIN tennis_rankings R1 on R1.player = P1.id AND R1.id = IF(P1.sexe = 1, 'wta', 'atp')
LEFT JOIN tennis_rankings R1B on R1B.player = P1B.id AND R1B.id = IF(P1B.sexe = 1, 'wta', 'atp')
LEFT JOIN tennis_rankings R2 on R2.player = P2.id AND R2.id = IF(P2.sexe = 1, 'wta', 'atp')
LEFT JOIN tennis_rankings R2B on R2B.player = P2B.id AND R2B.id = IF(P2B.sexe = 1, 'wta', 'atp')
LEFT JOIN `livescores_new`.`matchs` LS ON (LS.tt_match_id = M.id)
LEFT JOIN tournois_programmes S on S.idm = M.id
LEFT JOIN lieux_courts CT on (CT.ids = S.ids && CT.ordre = S.court)
JOIN `leagues_rounds` LR on LR.id = M.league_round
JOIN `leagues` L on L.id = LR.league
JOIN tournois_name N on N.league = L.id
LEFT JOIN lieux_sites SL on SL.id = LR.site
LEFT JOIN lieux_villes SC on SC.id = SL.idv
LEFT JOIN lieux_pays SCO on SCO.code = SC.pays
WHERE
M.id = '9432098'
&& M.type_tournoi_add = 2
&& (S.statut = 0 || S.statut = 4 || S.statut = 2 || ISNULL(S.statut))
LIMIT 1
SELECT M.*
, M.time_start time_start
, M.time time_end
, M.duration_pause
, M.type_match_add type_match
, M.type_tournoi_add type_tournament
, M.niveau level
, M.qualif
, M.idw winner_id
, P1.id p1_id
, P1.nom p1_name
, P1.prenom p1_first_name
, P1.name_zh p1_name_zh
, P1.birthday p1_birthday
, P1.sexe p1_gender
, P1.nat p1_nat
, P1.photo p1_photo
, P1.taille p1_height
, P1.poids p1_weight
, R1.rank p1_rank
, R1.liveRank p1_rank_live
, P1.pro_depuis p1_turn_pro
, '?' p1_best_rank
, P1.prise p1_forehand
, P1.revers p1_backhand
, M.ts1 p1_seed
, P1B.id p1b_id
, P1B.nom p1b_name
, P1B.prenom p1b_first_name
, P1B.name_zh p1b_name_zh
, P1B.birthday p1b_birthday
, P1B.sexe p1b_gender
, P1B.nat p1b_nat
, P1B.photo p1b_photo
, P1B.taille p1b_height
, P1B.poids p1b_weight
, R1B.rank p1b_rank
, R1B.liveRank p1b_rank_live
, P1B.pro_depuis p1b_turn_pro
, P2.id p2_id
, P2.nom p2_name
, P2.prenom p2_first_name
, P2.name_zh p2_name_zh
, P2.birthday p2_birthday
, P2.sexe p2_gender
, P2.nat p2_nat
, P2.photo p2_photo
, P2.taille p2_height
, P2.poids p2_weight
, R2.rank p2_rank
, R2.liveRank p2_rank_live
, P2.pro_depuis p2_turn_pro
, '?' p2_best_rank
, P2.prise p2_forehand
, P2.revers p2_backhand
, M.ts2 p2_seed
, P2B.id p2b_id
, P2B.nom p2b_name
, P2B.prenom p2b_first_name
, P2B.name_zh p2b_name_zh
, P2B.birthday p2b_birthday
, P2B.sexe p2b_gender
, P2B.nat p2b_nat
, P2B.photo p2b_photo
, P2B.taille p2b_height
, P2B.poids p2b_weight
, R2B.rank p2b_rank
, R2B.liveRank p2b_rank_live
, P2B.pro_depuis p2b_turn_pro
, T.id tournament_id
, T.idt tournament_idt
, '?' rencontre_id
, N.name_fr tournament_name_fr
, N.name_en tournament_name_en
, N.name_zh tournament_name_zh
, N.name_de tournament_name_de
, N.name_es tournament_name_es
, T.ville tournament_city
, T.stade tournament_stadium
, T.surface tournament_surface
, T.surface_photo tournament_surface_photo
, T.surface_color tournament_surface_color
, T.monnaie tournament_currency
, T.prix tournament_prize_money
, SCO.nom_fr tournament_country
, T.logo tournament_logo
, T.debut tournament_start
, T.fin tournament_end
, T.nbj tournament_nbPlayer
, T.genre tournament_genre
, T.category tournament_category
, T.type tournament_type
, T.ids tournament_site
, T.year tournament_year
, T.importance tournament_importance
, '' team1
, '' team2
, T.importance
, T.background tournament_background
, SC.fuseau_horaire
, IF(ISNULL(LS.status) || M.status = 2 || M.status = 3 || M.status = 4, M.status, LS.status) match_status
, LS.serve
, S.time s_time_start
, S.court
, S.date_loc
, S.type s_type
, S.ordre s_order
, C.nom court_name
, C.ordre court_order
FROM
tournois_matchs M
INNER JOIN joueurs P1 on P1.id = M.j1
LEFT OUTER JOIN `joueurs` P1B on P1B.id = M.j1_bis
INNER JOIN joueurs P2 on P2.id = M.j2
LEFT OUTER JOIN `joueurs` P2B on P2B.id = M.j2_bis
LEFT JOIN tennis_rankings R1 on R1.player = P1.id AND R1.id = IF(P1.sexe = 1, 'wta', 'atp')
LEFT JOIN tennis_rankings R1B on R1B.player = P1B.id AND R1B.id = IF(P1B.sexe = 1, 'wta', 'atp')
LEFT JOIN tennis_rankings R2 on R2.player = P2.id AND R2.id = IF(P2.sexe = 1, 'wta', 'atp')
LEFT JOIN tennis_rankings R2B on R2B.player = P2B.id AND R2B.id = IF(P2B.sexe = 1, 'wta', 'atp')
INNER JOIN tournois T on T.id = M.idt
INNER JOIN tournois_name N on N.id = T.id && N.cup = 0
LEFT OUTER JOIN lieux_sites SL on T.ids = SL.id
LEFT OUTER JOIN lieux_villes SC on SL.idv = SC.id
LEFT OUTER JOIN lieux_pays SCO on SCO.code = SC.pays
LEFT OUTER JOIN `livescores_new`.`matchs` LS on LS.tt_match_id = M.id
LEFT OUTER JOIN tournois_programmes S on S.idm = M.id
LEFT OUTER JOIN lieux_courts C on C.ids = S.ids && C.ordre = S.court
WHERE
M.id = '9432116'
&& M.type_tournoi_add = 0
&& (S.statut = 0 || S.statut = 4 || S.statut = 2 || ISNULL(S.statut))
UNION
SELECT
M.*
, M.time_start time_start
, M.time time_end
, M.duration_pause
, M.type_match_add type_match
, M.type_tournoi_add type_tournament
, CR.niveau level
, M.qualif
, M.idw winner_id
, P1.id p1_id
, P1.nom p1_name
, P1.prenom p1_first_name
, P1.name_zh p1_name_zh
, P1.birthday p1_birthday
, P1.sexe p1_gender
, P1.nat p1_nat
, P1.photo p1_photo
, P1.taille p1_height
, P1.poids p1_weight
, R1.rank p1_rank
, R1.liveRank p1_rank_live
, P1.pro_depuis p1_turn_pro
, '?' p1_best_rank
, P1.prise p1_forehand
, P1.revers p1_backhand
, M.ts1 p1_seed
, P1B.id p1b_id
, P1B.nom p1b_name
, P1B.prenom p1b_first_name
, P1B.name_zh p1b_name_zh
, P1B.birthday p1b_birthday
, P1B.sexe p1b_gender
, P1B.nat p1b_nat
, P1B.photo p1b_photo
, P1B.taille p1b_height
, P1B.poids p1b_weight
, R1B.rank p1b_rank
, R1B.liveRank p1b_rank_live
, P1B.pro_depuis p1b_turn_pro
, P2.id p2_id
, P2.nom p2_name
, P2.prenom p2_first_name
, P2.name_zh p2_name_zh
, P2.birthday p2_birthday
, P2.sexe p2_gender
, P2.nat p2_nat
, P2.photo p2_photo
, P2.taille p2_height
, P2.poids p2_weight
, R2.rank p2_rank
, R2.liveRank p2_rank_live
, P2.pro_depuis p2_turn_pro
, '?' p2_best_rank
, P2.prise p2_forehand
, P2.revers p2_backhand
, M.ts2 p2_seed
, P2B.id p2b_id
, P2B.nom p2b_name
, P2B.prenom p2b_first_name
, P2B.name_zh p2b_name_zh
, P2B.birthday p2b_birthday
, P2B.sexe p2b_gender
, P2B.nat p2b_nat
, P2B.photo p2b_photo
, P2B.taille p2b_height
, P2B.poids p2b_weight
, R2B.rank p2b_rank
, R2B.liveRank p2b_rank_live
, P2B.pro_depuis p2b_turn_pro
, C.id tournament_id
, C.parent tournament_idt
, CR.id rencontre_id
, N.name_fr tournament_name_fr
, N.name_en tournament_name_en
, N.name_zh tournament_name_zh
, N.name_de tournament_name_de
, N.name_es tournament_name_es
, CONCAT(CR.equipe_domicile, '|', CR.equipe_exterieur) tournament_city
, '' tournament_stadium
, CR.surface tournament_surface
, '' tournament_surface_photo
, '0' tournament_surface_color
, '' tournament_currency
, '' tournament_prize_money
, SCO.nom_fr tournament_country
, '' tournament_logo
, CR.date_d tournament_start
, '' tournament_end
, C.nbj tournament_nbPlayer
, '' tournament_genre
, '' tournament_category
, '' tournament_type
, CR.lieu tournament_site
, '' tournament_year
, 65 tournament_importance
, IF(T1.nom_fr, T1.nom_fr, CR.equipe_domicile) team1
, IF(T2.nom_fr, T1.nom_fr, CR.equipe_exterieur) team2
, 65 importance
, '' tournament_background
, SC.fuseau_horaire
, IF(ISNULL(LS.status) || M.status = 2 || M.status = 3 || M.status = 4, M.status, LS.status) match_status
, LS.serve
, S.time s_time_start
, S.court
, S.date_loc
, S.type s_type
, S.ordre s_order
, CT.nom court_name
, CT.ordre court_order
FROM
tournois_matchs M
INNER JOIN joueurs P1 on P1.id = M.j1
LEFT OUTER JOIN `joueurs` P1B on P1B.id = M.j1_bis
INNER JOIN joueurs P2 on P2.id = M.j2
LEFT OUTER JOIN `joueurs` P2B on P2B.id = M.j2_bis
LEFT JOIN tennis_rankings R1 on R1.player = P1.id AND R1.id = IF(P1.sexe = 1, 'wta', 'atp')
LEFT JOIN tennis_rankings R1B on R1B.player = P1B.id AND R1B.id = IF(P1B.sexe = 1, 'wta', 'atp')
LEFT JOIN tennis_rankings R2 on R2.player = P2.id AND R2.id = IF(P2.sexe = 1, 'wta', 'atp')
LEFT JOIN tennis_rankings R2B on R2B.player = P2B.id AND R2B.id = IF(P2B.sexe = 1, 'wta', 'atp')
LEFT OUTER JOIN `livescores_new`.`matchs` LS ON (LS.tt_match_id = M.id)
LEFT OUTER JOIN tournois_programmes S on S.idm = M.id
LEFT OUTER JOIN lieux_courts CT on (CT.ids = S.ids && CT.ordre = S.court)
INNER JOIN `coupes_rencontres` CR on CR.id = M.idt
INNER JOIN `coupes` C on C.id = CR.coupe_id
INNER JOIN tournois_name N on N.id = C.id
LEFT JOIN lieux_sites SL on SL.id = CR.lieu
LEFT JOIN lieux_villes SC on SC.id = SL.idv
LEFT JOIN lieux_pays SCO on SCO.code = SC.pays
LEFT JOIN `lieux_pays` T1 ON (T1.code = CR.equipe_domicile)
LEFT JOIN `lieux_pays` T2 ON (T2.code = CR.equipe_exterieur)
WHERE
M.id = '9432116'
&& M.type_tournoi_add = 1
&& (S.statut = 0 || S.statut = 4 || S.statut = 2 || ISNULL(S.statut))
UNION
SELECT
M.*
, M.time_start time_start
, M.time time_end
, M.duration_pause
, M.type_match_add type_match
, M.type_tournoi_add type_tournament
, '' level
, M.qualif
, M.idw winner_id
, P1.id p1_id
, P1.nom p1_name
, P1.prenom p1_first_name
, P1.name_zh p1_name_zh
, P1.birthday p1_birthday
, P1.sexe p1_gender
, P1.nat p1_nat
, P1.photo p1_photo
, P1.taille p1_height
, P1.poids p1_weight
, R1.rank p1_rank
, R1.liveRank p1_rank_live
, P1.pro_depuis p1_turn_pro
, '?' p1_best_rank
, P1.prise p1_forehand
, P1.revers p1_backhand
, M.ts1 p1_seed
, P1B.id p1b_id
, P1B.nom p1b_name
, P1B.prenom p1b_first_name
, P1B.name_zh p1b_name_zh
, P1B.birthday p1b_birthday
, P1B.sexe p1b_gender
, P1B.nat p1b_nat
, P1B.photo p1b_photo
, P1B.taille p1b_height
, P1B.poids p1b_weight
, R1B.rank p1b_rank
, R1B.liveRank p1b_rank_live
, P1B.pro_depuis p1b_turn_pro
, P2.id p2_id
, P2.nom p2_name
, P2.prenom p2_first_name
, P2.name_zh p2_name_zh
, P2.birthday p2_birthday
, P2.sexe p2_gender
, P2.nat p2_nat
, P2.photo p2_photo
, P2.taille p2_height
, P2.poids p2_weight
, R2.rank p2_rank
, R2.liveRank p2_rank_live
, P2.pro_depuis p2_turn_pro
, '?' p2_best_rank
, P2.prise p2_forehand
, P2.revers p2_backhand
, M.ts2 p2_seed
, P2B.id p2b_id
, P2B.nom p2b_name
, P2B.prenom p2b_first_name
, P2B.name_zh p2b_name_zh
, P2B.birthday p2b_birthday
, P2B.sexe p2b_gender
, P2B.nat p2b_nat
, P2B.photo p2b_photo
, P2B.taille p2b_height
, P2B.poids p2b_weight
, R2B.rank p2b_rank
, R2B.liveRank p2b_rank_live
, P2B.pro_depuis p2b_turn_pro
, L.id tournament_id
, 0 tournament_idt
, LR.id rencontre_id
, N.name_fr tournament_name_fr
, N.name_en tournament_name_en
, N.name_zh tournament_name_zh
, N.name_de tournament_name_de
, N.name_es tournament_name_es
, SC.nom tournament_city
, '' tournament_stadium
, '3' tournament_surface
, '' tournament_surface_photo
, '0' tournament_surface_color
, '' tournament_currency
, '' tournament_prize_money
, SCO.nom_fr tournament_country
, '' tournament_logo
, L.time_start tournament_start
, '' tournament_end
, '' tournament_nbPlayer
, '' tournament_genre
, '' tournament_category
, '' tournament_type
, LR.site tournament_site
, L.year tournament_year
, 0 tournament_importance
, '' team1
, '' team2
, 3 importance
, '' tournament_background
, SC.fuseau_horaire
, IF(ISNULL(LS.status) || M.status = 2 || M.status = 3 || M.status = 4, M.status, LS.status) match_status
, LS.serve
, S.time s_time_start
, S.court
, S.date_loc
, S.type s_type
, S.ordre s_order
, CT.nom court_name
, CT.ordre court_order
FROM
tournois_matchs M
JOIN joueurs P1 on P1.id = M.j1
LEFT JOIN `joueurs` P1B on P1B.id = M.j1_bis
JOIN joueurs P2 on P2.id = M.j2
LEFT JOIN `joueurs` P2B on P2B.id = M.j2_bis
LEFT JOIN tennis_rankings R1 on R1.player = P1.id AND R1.id = IF(P1.sexe = 1, 'wta', 'atp')
LEFT JOIN tennis_rankings R1B on R1B.player = P1B.id AND R1B.id = IF(P1B.sexe = 1, 'wta', 'atp')
LEFT JOIN tennis_rankings R2 on R2.player = P2.id AND R2.id = IF(P2.sexe = 1, 'wta', 'atp')
LEFT JOIN tennis_rankings R2B on R2B.player = P2B.id AND R2B.id = IF(P2B.sexe = 1, 'wta', 'atp')
LEFT JOIN `livescores_new`.`matchs` LS ON (LS.tt_match_id = M.id)
LEFT JOIN tournois_programmes S on S.idm = M.id
LEFT JOIN lieux_courts CT on (CT.ids = S.ids && CT.ordre = S.court)
JOIN `leagues_rounds` LR on LR.id = M.league_round
JOIN `leagues` L on L.id = LR.league
JOIN tournois_name N on N.league = L.id
LEFT JOIN lieux_sites SL on SL.id = LR.site
LEFT JOIN lieux_villes SC on SC.id = SL.idv
LEFT JOIN lieux_pays SCO on SCO.code = SC.pays
WHERE
M.id = '9432116'
&& M.type_tournoi_add = 2
&& (S.statut = 0 || S.statut = 4 || S.statut = 2 || ISNULL(S.statut))
LIMIT 1
SELECT M.*
, M.time_start time_start
, M.time time_end
, M.duration_pause
, M.type_match_add type_match
, M.type_tournoi_add type_tournament
, M.niveau level
, M.qualif
, M.idw winner_id
, P1.id p1_id
, P1.nom p1_name
, P1.prenom p1_first_name
, P1.name_zh p1_name_zh
, P1.birthday p1_birthday
, P1.sexe p1_gender
, P1.nat p1_nat
, P1.photo p1_photo
, P1.taille p1_height
, P1.poids p1_weight
, R1.rank p1_rank
, R1.liveRank p1_rank_live
, P1.pro_depuis p1_turn_pro
, '?' p1_best_rank
, P1.prise p1_forehand
, P1.revers p1_backhand
, M.ts1 p1_seed
, P1B.id p1b_id
, P1B.nom p1b_name
, P1B.prenom p1b_first_name
, P1B.name_zh p1b_name_zh
, P1B.birthday p1b_birthday
, P1B.sexe p1b_gender
, P1B.nat p1b_nat
, P1B.photo p1b_photo
, P1B.taille p1b_height
, P1B.poids p1b_weight
, R1B.rank p1b_rank
, R1B.liveRank p1b_rank_live
, P1B.pro_depuis p1b_turn_pro
, P2.id p2_id
, P2.nom p2_name
, P2.prenom p2_first_name
, P2.name_zh p2_name_zh
, P2.birthday p2_birthday
, P2.sexe p2_gender
, P2.nat p2_nat
, P2.photo p2_photo
, P2.taille p2_height
, P2.poids p2_weight
, R2.rank p2_rank
, R2.liveRank p2_rank_live
, P2.pro_depuis p2_turn_pro
, '?' p2_best_rank
, P2.prise p2_forehand
, P2.revers p2_backhand
, M.ts2 p2_seed
, P2B.id p2b_id
, P2B.nom p2b_name
, P2B.prenom p2b_first_name
, P2B.name_zh p2b_name_zh
, P2B.birthday p2b_birthday
, P2B.sexe p2b_gender
, P2B.nat p2b_nat
, P2B.photo p2b_photo
, P2B.taille p2b_height
, P2B.poids p2b_weight
, R2B.rank p2b_rank
, R2B.liveRank p2b_rank_live
, P2B.pro_depuis p2b_turn_pro
, T.id tournament_id
, T.idt tournament_idt
, '?' rencontre_id
, N.name_fr tournament_name_fr
, N.name_en tournament_name_en
, N.name_zh tournament_name_zh
, N.name_de tournament_name_de
, N.name_es tournament_name_es
, T.ville tournament_city
, T.stade tournament_stadium
, T.surface tournament_surface
, T.surface_photo tournament_surface_photo
, T.surface_color tournament_surface_color
, T.monnaie tournament_currency
, T.prix tournament_prize_money
, SCO.nom_fr tournament_country
, T.logo tournament_logo
, T.debut tournament_start
, T.fin tournament_end
, T.nbj tournament_nbPlayer
, T.genre tournament_genre
, T.category tournament_category
, T.type tournament_type
, T.ids tournament_site
, T.year tournament_year
, T.importance tournament_importance
, '' team1
, '' team2
, T.importance
, T.background tournament_background
, SC.fuseau_horaire
, IF(ISNULL(LS.status) || M.status = 2 || M.status = 3 || M.status = 4, M.status, LS.status) match_status
, LS.serve
, S.time s_time_start
, S.court
, S.date_loc
, S.type s_type
, S.ordre s_order
, C.nom court_name
, C.ordre court_order
FROM
tournois_matchs M
INNER JOIN joueurs P1 on P1.id = M.j1
LEFT OUTER JOIN `joueurs` P1B on P1B.id = M.j1_bis
INNER JOIN joueurs P2 on P2.id = M.j2
LEFT OUTER JOIN `joueurs` P2B on P2B.id = M.j2_bis
LEFT JOIN tennis_rankings R1 on R1.player = P1.id AND R1.id = IF(P1.sexe = 1, 'wta', 'atp')
LEFT JOIN tennis_rankings R1B on R1B.player = P1B.id AND R1B.id = IF(P1B.sexe = 1, 'wta', 'atp')
LEFT JOIN tennis_rankings R2 on R2.player = P2.id AND R2.id = IF(P2.sexe = 1, 'wta', 'atp')
LEFT JOIN tennis_rankings R2B on R2B.player = P2B.id AND R2B.id = IF(P2B.sexe = 1, 'wta', 'atp')
INNER JOIN tournois T on T.id = M.idt
INNER JOIN tournois_name N on N.id = T.id && N.cup = 0
LEFT OUTER JOIN lieux_sites SL on T.ids = SL.id
LEFT OUTER JOIN lieux_villes SC on SL.idv = SC.id
LEFT OUTER JOIN lieux_pays SCO on SCO.code = SC.pays
LEFT OUTER JOIN `livescores_new`.`matchs` LS on LS.tt_match_id = M.id
LEFT OUTER JOIN tournois_programmes S on S.idm = M.id
LEFT OUTER JOIN lieux_courts C on C.ids = S.ids && C.ordre = S.court
WHERE
M.id = '9432102'
&& M.type_tournoi_add = 0
&& (S.statut = 0 || S.statut = 4 || S.statut = 2 || ISNULL(S.statut))
UNION
SELECT
M.*
, M.time_start time_start
, M.time time_end
, M.duration_pause
, M.type_match_add type_match
, M.type_tournoi_add type_tournament
, CR.niveau level
, M.qualif
, M.idw winner_id
, P1.id p1_id
, P1.nom p1_name
, P1.prenom p1_first_name
, P1.name_zh p1_name_zh
, P1.birthday p1_birthday
, P1.sexe p1_gender
, P1.nat p1_nat
, P1.photo p1_photo
, P1.taille p1_height
, P1.poids p1_weight
, R1.rank p1_rank
, R1.liveRank p1_rank_live
, P1.pro_depuis p1_turn_pro
, '?' p1_best_rank
, P1.prise p1_forehand
, P1.revers p1_backhand
, M.ts1 p1_seed
, P1B.id p1b_id
, P1B.nom p1b_name
, P1B.prenom p1b_first_name
, P1B.name_zh p1b_name_zh
, P1B.birthday p1b_birthday
, P1B.sexe p1b_gender
, P1B.nat p1b_nat
, P1B.photo p1b_photo
, P1B.taille p1b_height
, P1B.poids p1b_weight
, R1B.rank p1b_rank
, R1B.liveRank p1b_rank_live
, P1B.pro_depuis p1b_turn_pro
, P2.id p2_id
, P2.nom p2_name
, P2.prenom p2_first_name
, P2.name_zh p2_name_zh
, P2.birthday p2_birthday
, P2.sexe p2_gender
, P2.nat p2_nat
, P2.photo p2_photo
, P2.taille p2_height
, P2.poids p2_weight
, R2.rank p2_rank
, R2.liveRank p2_rank_live
, P2.pro_depuis p2_turn_pro
, '?' p2_best_rank
, P2.prise p2_forehand
, P2.revers p2_backhand
, M.ts2 p2_seed
, P2B.id p2b_id
, P2B.nom p2b_name
, P2B.prenom p2b_first_name
, P2B.name_zh p2b_name_zh
, P2B.birthday p2b_birthday
, P2B.sexe p2b_gender
, P2B.nat p2b_nat
, P2B.photo p2b_photo
, P2B.taille p2b_height
, P2B.poids p2b_weight
, R2B.rank p2b_rank
, R2B.liveRank p2b_rank_live
, P2B.pro_depuis p2b_turn_pro
, C.id tournament_id
, C.parent tournament_idt
, CR.id rencontre_id
, N.name_fr tournament_name_fr
, N.name_en tournament_name_en
, N.name_zh tournament_name_zh
, N.name_de tournament_name_de
, N.name_es tournament_name_es
, CONCAT(CR.equipe_domicile, '|', CR.equipe_exterieur) tournament_city
, '' tournament_stadium
, CR.surface tournament_surface
, '' tournament_surface_photo
, '0' tournament_surface_color
, '' tournament_currency
, '' tournament_prize_money
, SCO.nom_fr tournament_country
, '' tournament_logo
, CR.date_d tournament_start
, '' tournament_end
, C.nbj tournament_nbPlayer
, '' tournament_genre
, '' tournament_category
, '' tournament_type
, CR.lieu tournament_site
, '' tournament_year
, 65 tournament_importance
, IF(T1.nom_fr, T1.nom_fr, CR.equipe_domicile) team1
, IF(T2.nom_fr, T1.nom_fr, CR.equipe_exterieur) team2
, 65 importance
, '' tournament_background
, SC.fuseau_horaire
, IF(ISNULL(LS.status) || M.status = 2 || M.status = 3 || M.status = 4, M.status, LS.status) match_status
, LS.serve
, S.time s_time_start
, S.court
, S.date_loc
, S.type s_type
, S.ordre s_order
, CT.nom court_name
, CT.ordre court_order
FROM
tournois_matchs M
INNER JOIN joueurs P1 on P1.id = M.j1
LEFT OUTER JOIN `joueurs` P1B on P1B.id = M.j1_bis
INNER JOIN joueurs P2 on P2.id = M.j2
LEFT OUTER JOIN `joueurs` P2B on P2B.id = M.j2_bis
LEFT JOIN tennis_rankings R1 on R1.player = P1.id AND R1.id = IF(P1.sexe = 1, 'wta', 'atp')
LEFT JOIN tennis_rankings R1B on R1B.player = P1B.id AND R1B.id = IF(P1B.sexe = 1, 'wta', 'atp')
LEFT JOIN tennis_rankings R2 on R2.player = P2.id AND R2.id = IF(P2.sexe = 1, 'wta', 'atp')
LEFT JOIN tennis_rankings R2B on R2B.player = P2B.id AND R2B.id = IF(P2B.sexe = 1, 'wta', 'atp')
LEFT OUTER JOIN `livescores_new`.`matchs` LS ON (LS.tt_match_id = M.id)
LEFT OUTER JOIN tournois_programmes S on S.idm = M.id
LEFT OUTER JOIN lieux_courts CT on (CT.ids = S.ids && CT.ordre = S.court)
INNER JOIN `coupes_rencontres` CR on CR.id = M.idt
INNER JOIN `coupes` C on C.id = CR.coupe_id
INNER JOIN tournois_name N on N.id = C.id
LEFT JOIN lieux_sites SL on SL.id = CR.lieu
LEFT JOIN lieux_villes SC on SC.id = SL.idv
LEFT JOIN lieux_pays SCO on SCO.code = SC.pays
LEFT JOIN `lieux_pays` T1 ON (T1.code = CR.equipe_domicile)
LEFT JOIN `lieux_pays` T2 ON (T2.code = CR.equipe_exterieur)
WHERE
M.id = '9432102'
&& M.type_tournoi_add = 1
&& (S.statut = 0 || S.statut = 4 || S.statut = 2 || ISNULL(S.statut))
UNION
SELECT
M.*
, M.time_start time_start
, M.time time_end
, M.duration_pause
, M.type_match_add type_match
, M.type_tournoi_add type_tournament
, '' level
, M.qualif
, M.idw winner_id
, P1.id p1_id
, P1.nom p1_name
, P1.prenom p1_first_name
, P1.name_zh p1_name_zh
, P1.birthday p1_birthday
, P1.sexe p1_gender
, P1.nat p1_nat
, P1.photo p1_photo
, P1.taille p1_height
, P1.poids p1_weight
, R1.rank p1_rank
, R1.liveRank p1_rank_live
, P1.pro_depuis p1_turn_pro
, '?' p1_best_rank
, P1.prise p1_forehand
, P1.revers p1_backhand
, M.ts1 p1_seed
, P1B.id p1b_id
, P1B.nom p1b_name
, P1B.prenom p1b_first_name
, P1B.name_zh p1b_name_zh
, P1B.birthday p1b_birthday
, P1B.sexe p1b_gender
, P1B.nat p1b_nat
, P1B.photo p1b_photo
, P1B.taille p1b_height
, P1B.poids p1b_weight
, R1B.rank p1b_rank
, R1B.liveRank p1b_rank_live
, P1B.pro_depuis p1b_turn_pro
, P2.id p2_id
, P2.nom p2_name
, P2.prenom p2_first_name
, P2.name_zh p2_name_zh
, P2.birthday p2_birthday
, P2.sexe p2_gender
, P2.nat p2_nat
, P2.photo p2_photo
, P2.taille p2_height
, P2.poids p2_weight
, R2.rank p2_rank
, R2.liveRank p2_rank_live
, P2.pro_depuis p2_turn_pro
, '?' p2_best_rank
, P2.prise p2_forehand
, P2.revers p2_backhand
, M.ts2 p2_seed
, P2B.id p2b_id
, P2B.nom p2b_name
, P2B.prenom p2b_first_name
, P2B.name_zh p2b_name_zh
, P2B.birthday p2b_birthday
, P2B.sexe p2b_gender
, P2B.nat p2b_nat
, P2B.photo p2b_photo
, P2B.taille p2b_height
, P2B.poids p2b_weight
, R2B.rank p2b_rank
, R2B.liveRank p2b_rank_live
, P2B.pro_depuis p2b_turn_pro
, L.id tournament_id
, 0 tournament_idt
, LR.id rencontre_id
, N.name_fr tournament_name_fr
, N.name_en tournament_name_en
, N.name_zh tournament_name_zh
, N.name_de tournament_name_de
, N.name_es tournament_name_es
, SC.nom tournament_city
, '' tournament_stadium
, '3' tournament_surface
, '' tournament_surface_photo
, '0' tournament_surface_color
, '' tournament_currency
, '' tournament_prize_money
, SCO.nom_fr tournament_country
, '' tournament_logo
, L.time_start tournament_start
, '' tournament_end
, '' tournament_nbPlayer
, '' tournament_genre
, '' tournament_category
, '' tournament_type
, LR.site tournament_site
, L.year tournament_year
, 0 tournament_importance
, '' team1
, '' team2
, 3 importance
, '' tournament_background
, SC.fuseau_horaire
, IF(ISNULL(LS.status) || M.status = 2 || M.status = 3 || M.status = 4, M.status, LS.status) match_status
, LS.serve
, S.time s_time_start
, S.court
, S.date_loc
, S.type s_type
, S.ordre s_order
, CT.nom court_name
, CT.ordre court_order
FROM
tournois_matchs M
JOIN joueurs P1 on P1.id = M.j1
LEFT JOIN `joueurs` P1B on P1B.id = M.j1_bis
JOIN joueurs P2 on P2.id = M.j2
LEFT JOIN `joueurs` P2B on P2B.id = M.j2_bis
LEFT JOIN tennis_rankings R1 on R1.player = P1.id AND R1.id = IF(P1.sexe = 1, 'wta', 'atp')
LEFT JOIN tennis_rankings R1B on R1B.player = P1B.id AND R1B.id = IF(P1B.sexe = 1, 'wta', 'atp')
LEFT JOIN tennis_rankings R2 on R2.player = P2.id AND R2.id = IF(P2.sexe = 1, 'wta', 'atp')
LEFT JOIN tennis_rankings R2B on R2B.player = P2B.id AND R2B.id = IF(P2B.sexe = 1, 'wta', 'atp')
LEFT JOIN `livescores_new`.`matchs` LS ON (LS.tt_match_id = M.id)
LEFT JOIN tournois_programmes S on S.idm = M.id
LEFT JOIN lieux_courts CT on (CT.ids = S.ids && CT.ordre = S.court)
JOIN `leagues_rounds` LR on LR.id = M.league_round
JOIN `leagues` L on L.id = LR.league
JOIN tournois_name N on N.league = L.id
LEFT JOIN lieux_sites SL on SL.id = LR.site
LEFT JOIN lieux_villes SC on SC.id = SL.idv
LEFT JOIN lieux_pays SCO on SCO.code = SC.pays
WHERE
M.id = '9432102'
&& M.type_tournoi_add = 2
&& (S.statut = 0 || S.statut = 4 || S.statut = 2 || ISNULL(S.statut))
LIMIT 1
SELECT M.*
, M.time_start time_start
, M.time time_end
, M.duration_pause
, M.type_match_add type_match
, M.type_tournoi_add type_tournament
, M.niveau level
, M.qualif
, M.idw winner_id
, P1.id p1_id
, P1.nom p1_name
, P1.prenom p1_first_name
, P1.name_zh p1_name_zh
, P1.birthday p1_birthday
, P1.sexe p1_gender
, P1.nat p1_nat
, P1.photo p1_photo
, P1.taille p1_height
, P1.poids p1_weight
, R1.rank p1_rank
, R1.liveRank p1_rank_live
, P1.pro_depuis p1_turn_pro
, '?' p1_best_rank
, P1.prise p1_forehand
, P1.revers p1_backhand
, M.ts1 p1_seed
, P1B.id p1b_id
, P1B.nom p1b_name
, P1B.prenom p1b_first_name
, P1B.name_zh p1b_name_zh
, P1B.birthday p1b_birthday
, P1B.sexe p1b_gender
, P1B.nat p1b_nat
, P1B.photo p1b_photo
, P1B.taille p1b_height
, P1B.poids p1b_weight
, R1B.rank p1b_rank
, R1B.liveRank p1b_rank_live
, P1B.pro_depuis p1b_turn_pro
, P2.id p2_id
, P2.nom p2_name
, P2.prenom p2_first_name
, P2.name_zh p2_name_zh
, P2.birthday p2_birthday
, P2.sexe p2_gender
, P2.nat p2_nat
, P2.photo p2_photo
, P2.taille p2_height
, P2.poids p2_weight
, R2.rank p2_rank
, R2.liveRank p2_rank_live
, P2.pro_depuis p2_turn_pro
, '?' p2_best_rank
, P2.prise p2_forehand
, P2.revers p2_backhand
, M.ts2 p2_seed
, P2B.id p2b_id
, P2B.nom p2b_name
, P2B.prenom p2b_first_name
, P2B.name_zh p2b_name_zh
, P2B.birthday p2b_birthday
, P2B.sexe p2b_gender
, P2B.nat p2b_nat
, P2B.photo p2b_photo
, P2B.taille p2b_height
, P2B.poids p2b_weight
, R2B.rank p2b_rank
, R2B.liveRank p2b_rank_live
, P2B.pro_depuis p2b_turn_pro
, T.id tournament_id
, T.idt tournament_idt
, '?' rencontre_id
, N.name_fr tournament_name_fr
, N.name_en tournament_name_en
, N.name_zh tournament_name_zh
, N.name_de tournament_name_de
, N.name_es tournament_name_es
, T.ville tournament_city
, T.stade tournament_stadium
, T.surface tournament_surface
, T.surface_photo tournament_surface_photo
, T.surface_color tournament_surface_color
, T.monnaie tournament_currency
, T.prix tournament_prize_money
, SCO.nom_fr tournament_country
, T.logo tournament_logo
, T.debut tournament_start
, T.fin tournament_end
, T.nbj tournament_nbPlayer
, T.genre tournament_genre
, T.category tournament_category
, T.type tournament_type
, T.ids tournament_site
, T.year tournament_year
, T.importance tournament_importance
, '' team1
, '' team2
, T.importance
, T.background tournament_background
, SC.fuseau_horaire
, IF(ISNULL(LS.status) || M.status = 2 || M.status = 3 || M.status = 4, M.status, LS.status) match_status
, LS.serve
, S.time s_time_start
, S.court
, S.date_loc
, S.type s_type
, S.ordre s_order
, C.nom court_name
, C.ordre court_order
FROM
tournois_matchs M
INNER JOIN joueurs P1 on P1.id = M.j1
LEFT OUTER JOIN `joueurs` P1B on P1B.id = M.j1_bis
INNER JOIN joueurs P2 on P2.id = M.j2
LEFT OUTER JOIN `joueurs` P2B on P2B.id = M.j2_bis
LEFT JOIN tennis_rankings R1 on R1.player = P1.id AND R1.id = IF(P1.sexe = 1, 'wta', 'atp')
LEFT JOIN tennis_rankings R1B on R1B.player = P1B.id AND R1B.id = IF(P1B.sexe = 1, 'wta', 'atp')
LEFT JOIN tennis_rankings R2 on R2.player = P2.id AND R2.id = IF(P2.sexe = 1, 'wta', 'atp')
LEFT JOIN tennis_rankings R2B on R2B.player = P2B.id AND R2B.id = IF(P2B.sexe = 1, 'wta', 'atp')
INNER JOIN tournois T on T.id = M.idt
INNER JOIN tournois_name N on N.id = T.id && N.cup = 0
LEFT OUTER JOIN lieux_sites SL on T.ids = SL.id
LEFT OUTER JOIN lieux_villes SC on SL.idv = SC.id
LEFT OUTER JOIN lieux_pays SCO on SCO.code = SC.pays
LEFT OUTER JOIN `livescores_new`.`matchs` LS on LS.tt_match_id = M.id
LEFT OUTER JOIN tournois_programmes S on S.idm = M.id
LEFT OUTER JOIN lieux_courts C on C.ids = S.ids && C.ordre = S.court
WHERE
M.id = '9431574'
&& M.type_tournoi_add = 0
&& (S.statut = 0 || S.statut = 4 || S.statut = 2 || ISNULL(S.statut))
UNION
SELECT
M.*
, M.time_start time_start
, M.time time_end
, M.duration_pause
, M.type_match_add type_match
, M.type_tournoi_add type_tournament
, CR.niveau level
, M.qualif
, M.idw winner_id
, P1.id p1_id
, P1.nom p1_name
, P1.prenom p1_first_name
, P1.name_zh p1_name_zh
, P1.birthday p1_birthday
, P1.sexe p1_gender
, P1.nat p1_nat
, P1.photo p1_photo
, P1.taille p1_height
, P1.poids p1_weight
, R1.rank p1_rank
, R1.liveRank p1_rank_live
, P1.pro_depuis p1_turn_pro
, '?' p1_best_rank
, P1.prise p1_forehand
, P1.revers p1_backhand
, M.ts1 p1_seed
, P1B.id p1b_id
, P1B.nom p1b_name
, P1B.prenom p1b_first_name
, P1B.name_zh p1b_name_zh
, P1B.birthday p1b_birthday
, P1B.sexe p1b_gender
, P1B.nat p1b_nat
, P1B.photo p1b_photo
, P1B.taille p1b_height
, P1B.poids p1b_weight
, R1B.rank p1b_rank
, R1B.liveRank p1b_rank_live
, P1B.pro_depuis p1b_turn_pro
, P2.id p2_id
, P2.nom p2_name
, P2.prenom p2_first_name
, P2.name_zh p2_name_zh
, P2.birthday p2_birthday
, P2.sexe p2_gender
, P2.nat p2_nat
, P2.photo p2_photo
, P2.taille p2_height
, P2.poids p2_weight
, R2.rank p2_rank
, R2.liveRank p2_rank_live
, P2.pro_depuis p2_turn_pro
, '?' p2_best_rank
, P2.prise p2_forehand
, P2.revers p2_backhand
, M.ts2 p2_seed
, P2B.id p2b_id
, P2B.nom p2b_name
, P2B.prenom p2b_first_name
, P2B.name_zh p2b_name_zh
, P2B.birthday p2b_birthday
, P2B.sexe p2b_gender
, P2B.nat p2b_nat
, P2B.photo p2b_photo
, P2B.taille p2b_height
, P2B.poids p2b_weight
, R2B.rank p2b_rank
, R2B.liveRank p2b_rank_live
, P2B.pro_depuis p2b_turn_pro
, C.id tournament_id
, C.parent tournament_idt
, CR.id rencontre_id
, N.name_fr tournament_name_fr
, N.name_en tournament_name_en
, N.name_zh tournament_name_zh
, N.name_de tournament_name_de
, N.name_es tournament_name_es
, CONCAT(CR.equipe_domicile, '|', CR.equipe_exterieur) tournament_city
, '' tournament_stadium
, CR.surface tournament_surface
, '' tournament_surface_photo
, '0' tournament_surface_color
, '' tournament_currency
, '' tournament_prize_money
, SCO.nom_fr tournament_country
, '' tournament_logo
, CR.date_d tournament_start
, '' tournament_end
, C.nbj tournament_nbPlayer
, '' tournament_genre
, '' tournament_category
, '' tournament_type
, CR.lieu tournament_site
, '' tournament_year
, 65 tournament_importance
, IF(T1.nom_fr, T1.nom_fr, CR.equipe_domicile) team1
, IF(T2.nom_fr, T1.nom_fr, CR.equipe_exterieur) team2
, 65 importance
, '' tournament_background
, SC.fuseau_horaire
, IF(ISNULL(LS.status) || M.status = 2 || M.status = 3 || M.status = 4, M.status, LS.status) match_status
, LS.serve
, S.time s_time_start
, S.court
, S.date_loc
, S.type s_type
, S.ordre s_order
, CT.nom court_name
, CT.ordre court_order
FROM
tournois_matchs M
INNER JOIN joueurs P1 on P1.id = M.j1
LEFT OUTER JOIN `joueurs` P1B on P1B.id = M.j1_bis
INNER JOIN joueurs P2 on P2.id = M.j2
LEFT OUTER JOIN `joueurs` P2B on P2B.id = M.j2_bis
LEFT JOIN tennis_rankings R1 on R1.player = P1.id AND R1.id = IF(P1.sexe = 1, 'wta', 'atp')
LEFT JOIN tennis_rankings R1B on R1B.player = P1B.id AND R1B.id = IF(P1B.sexe = 1, 'wta', 'atp')
LEFT JOIN tennis_rankings R2 on R2.player = P2.id AND R2.id = IF(P2.sexe = 1, 'wta', 'atp')
LEFT JOIN tennis_rankings R2B on R2B.player = P2B.id AND R2B.id = IF(P2B.sexe = 1, 'wta', 'atp')
LEFT OUTER JOIN `livescores_new`.`matchs` LS ON (LS.tt_match_id = M.id)
LEFT OUTER JOIN tournois_programmes S on S.idm = M.id
LEFT OUTER JOIN lieux_courts CT on (CT.ids = S.ids && CT.ordre = S.court)
INNER JOIN `coupes_rencontres` CR on CR.id = M.idt
INNER JOIN `coupes` C on C.id = CR.coupe_id
INNER JOIN tournois_name N on N.id = C.id
LEFT JOIN lieux_sites SL on SL.id = CR.lieu
LEFT JOIN lieux_villes SC on SC.id = SL.idv
LEFT JOIN lieux_pays SCO on SCO.code = SC.pays
LEFT JOIN `lieux_pays` T1 ON (T1.code = CR.equipe_domicile)
LEFT JOIN `lieux_pays` T2 ON (T2.code = CR.equipe_exterieur)
WHERE
M.id = '9431574'
&& M.type_tournoi_add = 1
&& (S.statut = 0 || S.statut = 4 || S.statut = 2 || ISNULL(S.statut))
UNION
SELECT
M.*
, M.time_start time_start
, M.time time_end
, M.duration_pause
, M.type_match_add type_match
, M.type_tournoi_add type_tournament
, '' level
, M.qualif
, M.idw winner_id
, P1.id p1_id
, P1.nom p1_name
, P1.prenom p1_first_name
, P1.name_zh p1_name_zh
, P1.birthday p1_birthday
, P1.sexe p1_gender
, P1.nat p1_nat
, P1.photo p1_photo
, P1.taille p1_height
, P1.poids p1_weight
, R1.rank p1_rank
, R1.liveRank p1_rank_live
, P1.pro_depuis p1_turn_pro
, '?' p1_best_rank
, P1.prise p1_forehand
, P1.revers p1_backhand
, M.ts1 p1_seed
, P1B.id p1b_id
, P1B.nom p1b_name
, P1B.prenom p1b_first_name
, P1B.name_zh p1b_name_zh
, P1B.birthday p1b_birthday
, P1B.sexe p1b_gender
, P1B.nat p1b_nat
, P1B.photo p1b_photo
, P1B.taille p1b_height
, P1B.poids p1b_weight
, R1B.rank p1b_rank
, R1B.liveRank p1b_rank_live
, P1B.pro_depuis p1b_turn_pro
, P2.id p2_id
, P2.nom p2_name
, P2.prenom p2_first_name
, P2.name_zh p2_name_zh
, P2.birthday p2_birthday
, P2.sexe p2_gender
, P2.nat p2_nat
, P2.photo p2_photo
, P2.taille p2_height
, P2.poids p2_weight
, R2.rank p2_rank
, R2.liveRank p2_rank_live
, P2.pro_depuis p2_turn_pro
, '?' p2_best_rank
, P2.prise p2_forehand
, P2.revers p2_backhand
, M.ts2 p2_seed
, P2B.id p2b_id
, P2B.nom p2b_name
, P2B.prenom p2b_first_name
, P2B.name_zh p2b_name_zh
, P2B.birthday p2b_birthday
, P2B.sexe p2b_gender
, P2B.nat p2b_nat
, P2B.photo p2b_photo
, P2B.taille p2b_height
, P2B.poids p2b_weight
, R2B.rank p2b_rank
, R2B.liveRank p2b_rank_live
, P2B.pro_depuis p2b_turn_pro
, L.id tournament_id
, 0 tournament_idt
, LR.id rencontre_id
, N.name_fr tournament_name_fr
, N.name_en tournament_name_en
, N.name_zh tournament_name_zh
, N.name_de tournament_name_de
, N.name_es tournament_name_es
, SC.nom tournament_city
, '' tournament_stadium
, '3' tournament_surface
, '' tournament_surface_photo
, '0' tournament_surface_color
, '' tournament_currency
, '' tournament_prize_money
, SCO.nom_fr tournament_country
, '' tournament_logo
, L.time_start tournament_start
, '' tournament_end
, '' tournament_nbPlayer
, '' tournament_genre
, '' tournament_category
, '' tournament_type
, LR.site tournament_site
, L.year tournament_year
, 0 tournament_importance
, '' team1
, '' team2
, 3 importance
, '' tournament_background
, SC.fuseau_horaire
, IF(ISNULL(LS.status) || M.status = 2 || M.status = 3 || M.status = 4, M.status, LS.status) match_status
, LS.serve
, S.time s_time_start
, S.court
, S.date_loc
, S.type s_type
, S.ordre s_order
, CT.nom court_name
, CT.ordre court_order
FROM
tournois_matchs M
JOIN joueurs P1 on P1.id = M.j1
LEFT JOIN `joueurs` P1B on P1B.id = M.j1_bis
JOIN joueurs P2 on P2.id = M.j2
LEFT JOIN `joueurs` P2B on P2B.id = M.j2_bis
LEFT JOIN tennis_rankings R1 on R1.player = P1.id AND R1.id = IF(P1.sexe = 1, 'wta', 'atp')
LEFT JOIN tennis_rankings R1B on R1B.player = P1B.id AND R1B.id = IF(P1B.sexe = 1, 'wta', 'atp')
LEFT JOIN tennis_rankings R2 on R2.player = P2.id AND R2.id = IF(P2.sexe = 1, 'wta', 'atp')
LEFT JOIN tennis_rankings R2B on R2B.player = P2B.id AND R2B.id = IF(P2B.sexe = 1, 'wta', 'atp')
LEFT JOIN `livescores_new`.`matchs` LS ON (LS.tt_match_id = M.id)
LEFT JOIN tournois_programmes S on S.idm = M.id
LEFT JOIN lieux_courts CT on (CT.ids = S.ids && CT.ordre = S.court)
JOIN `leagues_rounds` LR on LR.id = M.league_round
JOIN `leagues` L on L.id = LR.league
JOIN tournois_name N on N.league = L.id
LEFT JOIN lieux_sites SL on SL.id = LR.site
LEFT JOIN lieux_villes SC on SC.id = SL.idv
LEFT JOIN lieux_pays SCO on SCO.code = SC.pays
WHERE
M.id = '9431574'
&& M.type_tournoi_add = 2
&& (S.statut = 0 || S.statut = 4 || S.statut = 2 || ISNULL(S.statut))
LIMIT 1
SELECT M.*
, M.time_start time_start
, M.time time_end
, M.duration_pause
, M.type_match_add type_match
, M.type_tournoi_add type_tournament
, M.niveau level
, M.qualif
, M.idw winner_id
, P1.id p1_id
, P1.nom p1_name
, P1.prenom p1_first_name
, P1.name_zh p1_name_zh
, P1.birthday p1_birthday
, P1.sexe p1_gender
, P1.nat p1_nat
, P1.photo p1_photo
, P1.taille p1_height
, P1.poids p1_weight
, R1.rank p1_rank
, R1.liveRank p1_rank_live
, P1.pro_depuis p1_turn_pro
, '?' p1_best_rank
, P1.prise p1_forehand
, P1.revers p1_backhand
, M.ts1 p1_seed
, P1B.id p1b_id
, P1B.nom p1b_name
, P1B.prenom p1b_first_name
, P1B.name_zh p1b_name_zh
, P1B.birthday p1b_birthday
, P1B.sexe p1b_gender
, P1B.nat p1b_nat
, P1B.photo p1b_photo
, P1B.taille p1b_height
, P1B.poids p1b_weight
, R1B.rank p1b_rank
, R1B.liveRank p1b_rank_live
, P1B.pro_depuis p1b_turn_pro
, P2.id p2_id
, P2.nom p2_name
, P2.prenom p2_first_name
, P2.name_zh p2_name_zh
, P2.birthday p2_birthday
, P2.sexe p2_gender
, P2.nat p2_nat
, P2.photo p2_photo
, P2.taille p2_height
, P2.poids p2_weight
, R2.rank p2_rank
, R2.liveRank p2_rank_live
, P2.pro_depuis p2_turn_pro
, '?' p2_best_rank
, P2.prise p2_forehand
, P2.revers p2_backhand
, M.ts2 p2_seed
, P2B.id p2b_id
, P2B.nom p2b_name
, P2B.prenom p2b_first_name
, P2B.name_zh p2b_name_zh
, P2B.birthday p2b_birthday
, P2B.sexe p2b_gender
, P2B.nat p2b_nat
, P2B.photo p2b_photo
, P2B.taille p2b_height
, P2B.poids p2b_weight
, R2B.rank p2b_rank
, R2B.liveRank p2b_rank_live
, P2B.pro_depuis p2b_turn_pro
, T.id tournament_id
, T.idt tournament_idt
, '?' rencontre_id
, N.name_fr tournament_name_fr
, N.name_en tournament_name_en
, N.name_zh tournament_name_zh
, N.name_de tournament_name_de
, N.name_es tournament_name_es
, T.ville tournament_city
, T.stade tournament_stadium
, T.surface tournament_surface
, T.surface_photo tournament_surface_photo
, T.surface_color tournament_surface_color
, T.monnaie tournament_currency
, T.prix tournament_prize_money
, SCO.nom_fr tournament_country
, T.logo tournament_logo
, T.debut tournament_start
, T.fin tournament_end
, T.nbj tournament_nbPlayer
, T.genre tournament_genre
, T.category tournament_category
, T.type tournament_type
, T.ids tournament_site
, T.year tournament_year
, T.importance tournament_importance
, '' team1
, '' team2
, T.importance
, T.background tournament_background
, SC.fuseau_horaire
, IF(ISNULL(LS.status) || M.status = 2 || M.status = 3 || M.status = 4, M.status, LS.status) match_status
, LS.serve
, S.time s_time_start
, S.court
, S.date_loc
, S.type s_type
, S.ordre s_order
, C.nom court_name
, C.ordre court_order
FROM
tournois_matchs M
INNER JOIN joueurs P1 on P1.id = M.j1
LEFT OUTER JOIN `joueurs` P1B on P1B.id = M.j1_bis
INNER JOIN joueurs P2 on P2.id = M.j2
LEFT OUTER JOIN `joueurs` P2B on P2B.id = M.j2_bis
LEFT JOIN tennis_rankings R1 on R1.player = P1.id AND R1.id = IF(P1.sexe = 1, 'wta', 'atp')
LEFT JOIN tennis_rankings R1B on R1B.player = P1B.id AND R1B.id = IF(P1B.sexe = 1, 'wta', 'atp')
LEFT JOIN tennis_rankings R2 on R2.player = P2.id AND R2.id = IF(P2.sexe = 1, 'wta', 'atp')
LEFT JOIN tennis_rankings R2B on R2B.player = P2B.id AND R2B.id = IF(P2B.sexe = 1, 'wta', 'atp')
INNER JOIN tournois T on T.id = M.idt
INNER JOIN tournois_name N on N.id = T.id && N.cup = 0
LEFT OUTER JOIN lieux_sites SL on T.ids = SL.id
LEFT OUTER JOIN lieux_villes SC on SL.idv = SC.id
LEFT OUTER JOIN lieux_pays SCO on SCO.code = SC.pays
LEFT OUTER JOIN `livescores_new`.`matchs` LS on LS.tt_match_id = M.id
LEFT OUTER JOIN tournois_programmes S on S.idm = M.id
LEFT OUTER JOIN lieux_courts C on C.ids = S.ids && C.ordre = S.court
WHERE
M.id = '9431613'
&& M.type_tournoi_add = 0
&& (S.statut = 0 || S.statut = 4 || S.statut = 2 || ISNULL(S.statut))
UNION
SELECT
M.*
, M.time_start time_start
, M.time time_end
, M.duration_pause
, M.type_match_add type_match
, M.type_tournoi_add type_tournament
, CR.niveau level
, M.qualif
, M.idw winner_id
, P1.id p1_id
, P1.nom p1_name
, P1.prenom p1_first_name
, P1.name_zh p1_name_zh
, P1.birthday p1_birthday
, P1.sexe p1_gender
, P1.nat p1_nat
, P1.photo p1_photo
, P1.taille p1_height
, P1.poids p1_weight
, R1.rank p1_rank
, R1.liveRank p1_rank_live
, P1.pro_depuis p1_turn_pro
, '?' p1_best_rank
, P1.prise p1_forehand
, P1.revers p1_backhand
, M.ts1 p1_seed
, P1B.id p1b_id
, P1B.nom p1b_name
, P1B.prenom p1b_first_name
, P1B.name_zh p1b_name_zh
, P1B.birthday p1b_birthday
, P1B.sexe p1b_gender
, P1B.nat p1b_nat
, P1B.photo p1b_photo
, P1B.taille p1b_height
, P1B.poids p1b_weight
, R1B.rank p1b_rank
, R1B.liveRank p1b_rank_live
, P1B.pro_depuis p1b_turn_pro
, P2.id p2_id
, P2.nom p2_name
, P2.prenom p2_first_name
, P2.name_zh p2_name_zh
, P2.birthday p2_birthday
, P2.sexe p2_gender
, P2.nat p2_nat
, P2.photo p2_photo
, P2.taille p2_height
, P2.poids p2_weight
, R2.rank p2_rank
, R2.liveRank p2_rank_live
, P2.pro_depuis p2_turn_pro
, '?' p2_best_rank
, P2.prise p2_forehand
, P2.revers p2_backhand
, M.ts2 p2_seed
, P2B.id p2b_id
, P2B.nom p2b_name
, P2B.prenom p2b_first_name
, P2B.name_zh p2b_name_zh
, P2B.birthday p2b_birthday
, P2B.sexe p2b_gender
, P2B.nat p2b_nat
, P2B.photo p2b_photo
, P2B.taille p2b_height
, P2B.poids p2b_weight
, R2B.rank p2b_rank
, R2B.liveRank p2b_rank_live
, P2B.pro_depuis p2b_turn_pro
, C.id tournament_id
, C.parent tournament_idt
, CR.id rencontre_id
, N.name_fr tournament_name_fr
, N.name_en tournament_name_en
, N.name_zh tournament_name_zh
, N.name_de tournament_name_de
, N.name_es tournament_name_es
, CONCAT(CR.equipe_domicile, '|', CR.equipe_exterieur) tournament_city
, '' tournament_stadium
, CR.surface tournament_surface
, '' tournament_surface_photo
, '0' tournament_surface_color
, '' tournament_currency
, '' tournament_prize_money
, SCO.nom_fr tournament_country
, '' tournament_logo
, CR.date_d tournament_start
, '' tournament_end
, C.nbj tournament_nbPlayer
, '' tournament_genre
, '' tournament_category
, '' tournament_type
, CR.lieu tournament_site
, '' tournament_year
, 65 tournament_importance
, IF(T1.nom_fr, T1.nom_fr, CR.equipe_domicile) team1
, IF(T2.nom_fr, T1.nom_fr, CR.equipe_exterieur) team2
, 65 importance
, '' tournament_background
, SC.fuseau_horaire
, IF(ISNULL(LS.status) || M.status = 2 || M.status = 3 || M.status = 4, M.status, LS.status) match_status
, LS.serve
, S.time s_time_start
, S.court
, S.date_loc
, S.type s_type
, S.ordre s_order
, CT.nom court_name
, CT.ordre court_order
FROM
tournois_matchs M
INNER JOIN joueurs P1 on P1.id = M.j1
LEFT OUTER JOIN `joueurs` P1B on P1B.id = M.j1_bis
INNER JOIN joueurs P2 on P2.id = M.j2
LEFT OUTER JOIN `joueurs` P2B on P2B.id = M.j2_bis
LEFT JOIN tennis_rankings R1 on R1.player = P1.id AND R1.id = IF(P1.sexe = 1, 'wta', 'atp')
LEFT JOIN tennis_rankings R1B on R1B.player = P1B.id AND R1B.id = IF(P1B.sexe = 1, 'wta', 'atp')
LEFT JOIN tennis_rankings R2 on R2.player = P2.id AND R2.id = IF(P2.sexe = 1, 'wta', 'atp')
LEFT JOIN tennis_rankings R2B on R2B.player = P2B.id AND R2B.id = IF(P2B.sexe = 1, 'wta', 'atp')
LEFT OUTER JOIN `livescores_new`.`matchs` LS ON (LS.tt_match_id = M.id)
LEFT OUTER JOIN tournois_programmes S on S.idm = M.id
LEFT OUTER JOIN lieux_courts CT on (CT.ids = S.ids && CT.ordre = S.court)
INNER JOIN `coupes_rencontres` CR on CR.id = M.idt
INNER JOIN `coupes` C on C.id = CR.coupe_id
INNER JOIN tournois_name N on N.id = C.id
LEFT JOIN lieux_sites SL on SL.id = CR.lieu
LEFT JOIN lieux_villes SC on SC.id = SL.idv
LEFT JOIN lieux_pays SCO on SCO.code = SC.pays
LEFT JOIN `lieux_pays` T1 ON (T1.code = CR.equipe_domicile)
LEFT JOIN `lieux_pays` T2 ON (T2.code = CR.equipe_exterieur)
WHERE
M.id = '9431613'
&& M.type_tournoi_add = 1
&& (S.statut = 0 || S.statut = 4 || S.statut = 2 || ISNULL(S.statut))
UNION
SELECT
M.*
, M.time_start time_start
, M.time time_end
, M.duration_pause
, M.type_match_add type_match
, M.type_tournoi_add type_tournament
, '' level
, M.qualif
, M.idw winner_id
, P1.id p1_id
, P1.nom p1_name
, P1.prenom p1_first_name
, P1.name_zh p1_name_zh
, P1.birthday p1_birthday
, P1.sexe p1_gender
, P1.nat p1_nat
, P1.photo p1_photo
, P1.taille p1_height
, P1.poids p1_weight
, R1.rank p1_rank
, R1.liveRank p1_rank_live
, P1.pro_depuis p1_turn_pro
, '?' p1_best_rank
, P1.prise p1_forehand
, P1.revers p1_backhand
, M.ts1 p1_seed
, P1B.id p1b_id
, P1B.nom p1b_name
, P1B.prenom p1b_first_name
, P1B.name_zh p1b_name_zh
, P1B.birthday p1b_birthday
, P1B.sexe p1b_gender
, P1B.nat p1b_nat
, P1B.photo p1b_photo
, P1B.taille p1b_height
, P1B.poids p1b_weight
, R1B.rank p1b_rank
, R1B.liveRank p1b_rank_live
, P1B.pro_depuis p1b_turn_pro
, P2.id p2_id
, P2.nom p2_name
, P2.prenom p2_first_name
, P2.name_zh p2_name_zh
, P2.birthday p2_birthday
, P2.sexe p2_gender
, P2.nat p2_nat
, P2.photo p2_photo
, P2.taille p2_height
, P2.poids p2_weight
, R2.rank p2_rank
, R2.liveRank p2_rank_live
, P2.pro_depuis p2_turn_pro
, '?' p2_best_rank
, P2.prise p2_forehand
, P2.revers p2_backhand
, M.ts2 p2_seed
, P2B.id p2b_id
, P2B.nom p2b_name
, P2B.prenom p2b_first_name
, P2B.name_zh p2b_name_zh
, P2B.birthday p2b_birthday
, P2B.sexe p2b_gender
, P2B.nat p2b_nat
, P2B.photo p2b_photo
, P2B.taille p2b_height
, P2B.poids p2b_weight
, R2B.rank p2b_rank
, R2B.liveRank p2b_rank_live
, P2B.pro_depuis p2b_turn_pro
, L.id tournament_id
, 0 tournament_idt
, LR.id rencontre_id
, N.name_fr tournament_name_fr
, N.name_en tournament_name_en
, N.name_zh tournament_name_zh
, N.name_de tournament_name_de
, N.name_es tournament_name_es
, SC.nom tournament_city
, '' tournament_stadium
, '3' tournament_surface
, '' tournament_surface_photo
, '0' tournament_surface_color
, '' tournament_currency
, '' tournament_prize_money
, SCO.nom_fr tournament_country
, '' tournament_logo
, L.time_start tournament_start
, '' tournament_end
, '' tournament_nbPlayer
, '' tournament_genre
, '' tournament_category
, '' tournament_type
, LR.site tournament_site
, L.year tournament_year
, 0 tournament_importance
, '' team1
, '' team2
, 3 importance
, '' tournament_background
, SC.fuseau_horaire
, IF(ISNULL(LS.status) || M.status = 2 || M.status = 3 || M.status = 4, M.status, LS.status) match_status
, LS.serve
, S.time s_time_start
, S.court
, S.date_loc
, S.type s_type
, S.ordre s_order
, CT.nom court_name
, CT.ordre court_order
FROM
tournois_matchs M
JOIN joueurs P1 on P1.id = M.j1
LEFT JOIN `joueurs` P1B on P1B.id = M.j1_bis
JOIN joueurs P2 on P2.id = M.j2
LEFT JOIN `joueurs` P2B on P2B.id = M.j2_bis
LEFT JOIN tennis_rankings R1 on R1.player = P1.id AND R1.id = IF(P1.sexe = 1, 'wta', 'atp')
LEFT JOIN tennis_rankings R1B on R1B.player = P1B.id AND R1B.id = IF(P1B.sexe = 1, 'wta', 'atp')
LEFT JOIN tennis_rankings R2 on R2.player = P2.id AND R2.id = IF(P2.sexe = 1, 'wta', 'atp')
LEFT JOIN tennis_rankings R2B on R2B.player = P2B.id AND R2B.id = IF(P2B.sexe = 1, 'wta', 'atp')
LEFT JOIN `livescores_new`.`matchs` LS ON (LS.tt_match_id = M.id)
LEFT JOIN tournois_programmes S on S.idm = M.id
LEFT JOIN lieux_courts CT on (CT.ids = S.ids && CT.ordre = S.court)
JOIN `leagues_rounds` LR on LR.id = M.league_round
JOIN `leagues` L on L.id = LR.league
JOIN tournois_name N on N.league = L.id
LEFT JOIN lieux_sites SL on SL.id = LR.site
LEFT JOIN lieux_villes SC on SC.id = SL.idv
LEFT JOIN lieux_pays SCO on SCO.code = SC.pays
WHERE
M.id = '9431613'
&& M.type_tournoi_add = 2
&& (S.statut = 0 || S.statut = 4 || S.statut = 2 || ISNULL(S.statut))
LIMIT 1
SELECT M.*
, M.time_start time_start
, M.time time_end
, M.duration_pause
, M.type_match_add type_match
, M.type_tournoi_add type_tournament
, M.niveau level
, M.qualif
, M.idw winner_id
, P1.id p1_id
, P1.nom p1_name
, P1.prenom p1_first_name
, P1.name_zh p1_name_zh
, P1.birthday p1_birthday
, P1.sexe p1_gender
, P1.nat p1_nat
, P1.photo p1_photo
, P1.taille p1_height
, P1.poids p1_weight
, R1.rank p1_rank
, R1.liveRank p1_rank_live
, P1.pro_depuis p1_turn_pro
, '?' p1_best_rank
, P1.prise p1_forehand
, P1.revers p1_backhand
, M.ts1 p1_seed
, P1B.id p1b_id
, P1B.nom p1b_name
, P1B.prenom p1b_first_name
, P1B.name_zh p1b_name_zh
, P1B.birthday p1b_birthday
, P1B.sexe p1b_gender
, P1B.nat p1b_nat
, P1B.photo p1b_photo
, P1B.taille p1b_height
, P1B.poids p1b_weight
, R1B.rank p1b_rank
, R1B.liveRank p1b_rank_live
, P1B.pro_depuis p1b_turn_pro
, P2.id p2_id
, P2.nom p2_name
, P2.prenom p2_first_name
, P2.name_zh p2_name_zh
, P2.birthday p2_birthday
, P2.sexe p2_gender
, P2.nat p2_nat
, P2.photo p2_photo
, P2.taille p2_height
, P2.poids p2_weight
, R2.rank p2_rank
, R2.liveRank p2_rank_live
, P2.pro_depuis p2_turn_pro
, '?' p2_best_rank
, P2.prise p2_forehand
, P2.revers p2_backhand
, M.ts2 p2_seed
, P2B.id p2b_id
, P2B.nom p2b_name
, P2B.prenom p2b_first_name
, P2B.name_zh p2b_name_zh
, P2B.birthday p2b_birthday
, P2B.sexe p2b_gender
, P2B.nat p2b_nat
, P2B.photo p2b_photo
, P2B.taille p2b_height
, P2B.poids p2b_weight
, R2B.rank p2b_rank
, R2B.liveRank p2b_rank_live
, P2B.pro_depuis p2b_turn_pro
, T.id tournament_id
, T.idt tournament_idt
, '?' rencontre_id
, N.name_fr tournament_name_fr
, N.name_en tournament_name_en
, N.name_zh tournament_name_zh
, N.name_de tournament_name_de
, N.name_es tournament_name_es
, T.ville tournament_city
, T.stade tournament_stadium
, T.surface tournament_surface
, T.surface_photo tournament_surface_photo
, T.surface_color tournament_surface_color
, T.monnaie tournament_currency
, T.prix tournament_prize_money
, SCO.nom_fr tournament_country
, T.logo tournament_logo
, T.debut tournament_start
, T.fin tournament_end
, T.nbj tournament_nbPlayer
, T.genre tournament_genre
, T.category tournament_category
, T.type tournament_type
, T.ids tournament_site
, T.year tournament_year
, T.importance tournament_importance
, '' team1
, '' team2
, T.importance
, T.background tournament_background
, SC.fuseau_horaire
, IF(ISNULL(LS.status) || M.status = 2 || M.status = 3 || M.status = 4, M.status, LS.status) match_status
, LS.serve
, S.time s_time_start
, S.court
, S.date_loc
, S.type s_type
, S.ordre s_order
, C.nom court_name
, C.ordre court_order
FROM
tournois_matchs M
INNER JOIN joueurs P1 on P1.id = M.j1
LEFT OUTER JOIN `joueurs` P1B on P1B.id = M.j1_bis
INNER JOIN joueurs P2 on P2.id = M.j2
LEFT OUTER JOIN `joueurs` P2B on P2B.id = M.j2_bis
LEFT JOIN tennis_rankings R1 on R1.player = P1.id AND R1.id = IF(P1.sexe = 1, 'wta', 'atp')
LEFT JOIN tennis_rankings R1B on R1B.player = P1B.id AND R1B.id = IF(P1B.sexe = 1, 'wta', 'atp')
LEFT JOIN tennis_rankings R2 on R2.player = P2.id AND R2.id = IF(P2.sexe = 1, 'wta', 'atp')
LEFT JOIN tennis_rankings R2B on R2B.player = P2B.id AND R2B.id = IF(P2B.sexe = 1, 'wta', 'atp')
INNER JOIN tournois T on T.id = M.idt
INNER JOIN tournois_name N on N.id = T.id && N.cup = 0
LEFT OUTER JOIN lieux_sites SL on T.ids = SL.id
LEFT OUTER JOIN lieux_villes SC on SL.idv = SC.id
LEFT OUTER JOIN lieux_pays SCO on SCO.code = SC.pays
LEFT OUTER JOIN `livescores_new`.`matchs` LS on LS.tt_match_id = M.id
LEFT OUTER JOIN tournois_programmes S on S.idm = M.id
LEFT OUTER JOIN lieux_courts C on C.ids = S.ids && C.ordre = S.court
WHERE
M.id = '9431619'
&& M.type_tournoi_add = 0
&& (S.statut = 0 || S.statut = 4 || S.statut = 2 || ISNULL(S.statut))
UNION
SELECT
M.*
, M.time_start time_start
, M.time time_end
, M.duration_pause
, M.type_match_add type_match
, M.type_tournoi_add type_tournament
, CR.niveau level
, M.qualif
, M.idw winner_id
, P1.id p1_id
, P1.nom p1_name
, P1.prenom p1_first_name
, P1.name_zh p1_name_zh
, P1.birthday p1_birthday
, P1.sexe p1_gender
, P1.nat p1_nat
, P1.photo p1_photo
, P1.taille p1_height
, P1.poids p1_weight
, R1.rank p1_rank
, R1.liveRank p1_rank_live
, P1.pro_depuis p1_turn_pro
, '?' p1_best_rank
, P1.prise p1_forehand
, P1.revers p1_backhand
, M.ts1 p1_seed
, P1B.id p1b_id
, P1B.nom p1b_name
, P1B.prenom p1b_first_name
, P1B.name_zh p1b_name_zh
, P1B.birthday p1b_birthday
, P1B.sexe p1b_gender
, P1B.nat p1b_nat
, P1B.photo p1b_photo
, P1B.taille p1b_height
, P1B.poids p1b_weight
, R1B.rank p1b_rank
, R1B.liveRank p1b_rank_live
, P1B.pro_depuis p1b_turn_pro
, P2.id p2_id
, P2.nom p2_name
, P2.prenom p2_first_name
, P2.name_zh p2_name_zh
, P2.birthday p2_birthday
, P2.sexe p2_gender
, P2.nat p2_nat
, P2.photo p2_photo
, P2.taille p2_height
, P2.poids p2_weight
, R2.rank p2_rank
, R2.liveRank p2_rank_live
, P2.pro_depuis p2_turn_pro
, '?' p2_best_rank
, P2.prise p2_forehand
, P2.revers p2_backhand
, M.ts2 p2_seed
, P2B.id p2b_id
, P2B.nom p2b_name
, P2B.prenom p2b_first_name
, P2B.name_zh p2b_name_zh
, P2B.birthday p2b_birthday
, P2B.sexe p2b_gender
, P2B.nat p2b_nat
, P2B.photo p2b_photo
, P2B.taille p2b_height
, P2B.poids p2b_weight
, R2B.rank p2b_rank
, R2B.liveRank p2b_rank_live
, P2B.pro_depuis p2b_turn_pro
, C.id tournament_id
, C.parent tournament_idt
, CR.id rencontre_id
, N.name_fr tournament_name_fr
, N.name_en tournament_name_en
, N.name_zh tournament_name_zh
, N.name_de tournament_name_de
, N.name_es tournament_name_es
, CONCAT(CR.equipe_domicile, '|', CR.equipe_exterieur) tournament_city
, '' tournament_stadium
, CR.surface tournament_surface
, '' tournament_surface_photo
, '0' tournament_surface_color
, '' tournament_currency
, '' tournament_prize_money
, SCO.nom_fr tournament_country
, '' tournament_logo
, CR.date_d tournament_start
, '' tournament_end
, C.nbj tournament_nbPlayer
, '' tournament_genre
, '' tournament_category
, '' tournament_type
, CR.lieu tournament_site
, '' tournament_year
, 65 tournament_importance
, IF(T1.nom_fr, T1.nom_fr, CR.equipe_domicile) team1
, IF(T2.nom_fr, T1.nom_fr, CR.equipe_exterieur) team2
, 65 importance
, '' tournament_background
, SC.fuseau_horaire
, IF(ISNULL(LS.status) || M.status = 2 || M.status = 3 || M.status = 4, M.status, LS.status) match_status
, LS.serve
, S.time s_time_start
, S.court
, S.date_loc
, S.type s_type
, S.ordre s_order
, CT.nom court_name
, CT.ordre court_order
FROM
tournois_matchs M
INNER JOIN joueurs P1 on P1.id = M.j1
LEFT OUTER JOIN `joueurs` P1B on P1B.id = M.j1_bis
INNER JOIN joueurs P2 on P2.id = M.j2
LEFT OUTER JOIN `joueurs` P2B on P2B.id = M.j2_bis
LEFT JOIN tennis_rankings R1 on R1.player = P1.id AND R1.id = IF(P1.sexe = 1, 'wta', 'atp')
LEFT JOIN tennis_rankings R1B on R1B.player = P1B.id AND R1B.id = IF(P1B.sexe = 1, 'wta', 'atp')
LEFT JOIN tennis_rankings R2 on R2.player = P2.id AND R2.id = IF(P2.sexe = 1, 'wta', 'atp')
LEFT JOIN tennis_rankings R2B on R2B.player = P2B.id AND R2B.id = IF(P2B.sexe = 1, 'wta', 'atp')
LEFT OUTER JOIN `livescores_new`.`matchs` LS ON (LS.tt_match_id = M.id)
LEFT OUTER JOIN tournois_programmes S on S.idm = M.id
LEFT OUTER JOIN lieux_courts CT on (CT.ids = S.ids && CT.ordre = S.court)
INNER JOIN `coupes_rencontres` CR on CR.id = M.idt
INNER JOIN `coupes` C on C.id = CR.coupe_id
INNER JOIN tournois_name N on N.id = C.id
LEFT JOIN lieux_sites SL on SL.id = CR.lieu
LEFT JOIN lieux_villes SC on SC.id = SL.idv
LEFT JOIN lieux_pays SCO on SCO.code = SC.pays
LEFT JOIN `lieux_pays` T1 ON (T1.code = CR.equipe_domicile)
LEFT JOIN `lieux_pays` T2 ON (T2.code = CR.equipe_exterieur)
WHERE
M.id = '9431619'
&& M.type_tournoi_add = 1
&& (S.statut = 0 || S.statut = 4 || S.statut = 2 || ISNULL(S.statut))
UNION
SELECT
M.*
, M.time_start time_start
, M.time time_end
, M.duration_pause
, M.type_match_add type_match
, M.type_tournoi_add type_tournament
, '' level
, M.qualif
, M.idw winner_id
, P1.id p1_id
, P1.nom p1_name
, P1.prenom p1_first_name
, P1.name_zh p1_name_zh
, P1.birthday p1_birthday
, P1.sexe p1_gender
, P1.nat p1_nat
, P1.photo p1_photo
, P1.taille p1_height
, P1.poids p1_weight
, R1.rank p1_rank
, R1.liveRank p1_rank_live
, P1.pro_depuis p1_turn_pro
, '?' p1_best_rank
, P1.prise p1_forehand
, P1.revers p1_backhand
, M.ts1 p1_seed
, P1B.id p1b_id
, P1B.nom p1b_name
, P1B.prenom p1b_first_name
, P1B.name_zh p1b_name_zh
, P1B.birthday p1b_birthday
, P1B.sexe p1b_gender
, P1B.nat p1b_nat
, P1B.photo p1b_photo
, P1B.taille p1b_height
, P1B.poids p1b_weight
, R1B.rank p1b_rank
, R1B.liveRank p1b_rank_live
, P1B.pro_depuis p1b_turn_pro
, P2.id p2_id
, P2.nom p2_name
, P2.prenom p2_first_name
, P2.name_zh p2_name_zh
, P2.birthday p2_birthday
, P2.sexe p2_gender
, P2.nat p2_nat
, P2.photo p2_photo
, P2.taille p2_height
, P2.poids p2_weight
, R2.rank p2_rank
, R2.liveRank p2_rank_live
, P2.pro_depuis p2_turn_pro
, '?' p2_best_rank
, P2.prise p2_forehand
, P2.revers p2_backhand
, M.ts2 p2_seed
, P2B.id p2b_id
, P2B.nom p2b_name
, P2B.prenom p2b_first_name
, P2B.name_zh p2b_name_zh
, P2B.birthday p2b_birthday
, P2B.sexe p2b_gender
, P2B.nat p2b_nat
, P2B.photo p2b_photo
, P2B.taille p2b_height
, P2B.poids p2b_weight
, R2B.rank p2b_rank
, R2B.liveRank p2b_rank_live
, P2B.pro_depuis p2b_turn_pro
, L.id tournament_id
, 0 tournament_idt
, LR.id rencontre_id
, N.name_fr tournament_name_fr
, N.name_en tournament_name_en
, N.name_zh tournament_name_zh
, N.name_de tournament_name_de
, N.name_es tournament_name_es
, SC.nom tournament_city
, '' tournament_stadium
, '3' tournament_surface
, '' tournament_surface_photo
, '0' tournament_surface_color
, '' tournament_currency
, '' tournament_prize_money
, SCO.nom_fr tournament_country
, '' tournament_logo
, L.time_start tournament_start
, '' tournament_end
, '' tournament_nbPlayer
, '' tournament_genre
, '' tournament_category
, '' tournament_type
, LR.site tournament_site
, L.year tournament_year
, 0 tournament_importance
, '' team1
, '' team2
, 3 importance
, '' tournament_background
, SC.fuseau_horaire
, IF(ISNULL(LS.status) || M.status = 2 || M.status = 3 || M.status = 4, M.status, LS.status) match_status
, LS.serve
, S.time s_time_start
, S.court
, S.date_loc
, S.type s_type
, S.ordre s_order
, CT.nom court_name
, CT.ordre court_order
FROM
tournois_matchs M
JOIN joueurs P1 on P1.id = M.j1
LEFT JOIN `joueurs` P1B on P1B.id = M.j1_bis
JOIN joueurs P2 on P2.id = M.j2
LEFT JOIN `joueurs` P2B on P2B.id = M.j2_bis
LEFT JOIN tennis_rankings R1 on R1.player = P1.id AND R1.id = IF(P1.sexe = 1, 'wta', 'atp')
LEFT JOIN tennis_rankings R1B on R1B.player = P1B.id AND R1B.id = IF(P1B.sexe = 1, 'wta', 'atp')
LEFT JOIN tennis_rankings R2 on R2.player = P2.id AND R2.id = IF(P2.sexe = 1, 'wta', 'atp')
LEFT JOIN tennis_rankings R2B on R2B.player = P2B.id AND R2B.id = IF(P2B.sexe = 1, 'wta', 'atp')
LEFT JOIN `livescores_new`.`matchs` LS ON (LS.tt_match_id = M.id)
LEFT JOIN tournois_programmes S on S.idm = M.id
LEFT JOIN lieux_courts CT on (CT.ids = S.ids && CT.ordre = S.court)
JOIN `leagues_rounds` LR on LR.id = M.league_round
JOIN `leagues` L on L.id = LR.league
JOIN tournois_name N on N.league = L.id
LEFT JOIN lieux_sites SL on SL.id = LR.site
LEFT JOIN lieux_villes SC on SC.id = SL.idv
LEFT JOIN lieux_pays SCO on SCO.code = SC.pays
WHERE
M.id = '9431619'
&& M.type_tournoi_add = 2
&& (S.statut = 0 || S.statut = 4 || S.statut = 2 || ISNULL(S.statut))
LIMIT 1
SELECT M.*
, M.time_start time_start
, M.time time_end
, M.duration_pause
, M.type_match_add type_match
, M.type_tournoi_add type_tournament
, M.niveau level
, M.qualif
, M.idw winner_id
, P1.id p1_id
, P1.nom p1_name
, P1.prenom p1_first_name
, P1.name_zh p1_name_zh
, P1.birthday p1_birthday
, P1.sexe p1_gender
, P1.nat p1_nat
, P1.photo p1_photo
, P1.taille p1_height
, P1.poids p1_weight
, R1.rank p1_rank
, R1.liveRank p1_rank_live
, P1.pro_depuis p1_turn_pro
, '?' p1_best_rank
, P1.prise p1_forehand
, P1.revers p1_backhand
, M.ts1 p1_seed
, P1B.id p1b_id
, P1B.nom p1b_name
, P1B.prenom p1b_first_name
, P1B.name_zh p1b_name_zh
, P1B.birthday p1b_birthday
, P1B.sexe p1b_gender
, P1B.nat p1b_nat
, P1B.photo p1b_photo
, P1B.taille p1b_height
, P1B.poids p1b_weight
, R1B.rank p1b_rank
, R1B.liveRank p1b_rank_live
, P1B.pro_depuis p1b_turn_pro
, P2.id p2_id
, P2.nom p2_name
, P2.prenom p2_first_name
, P2.name_zh p2_name_zh
, P2.birthday p2_birthday
, P2.sexe p2_gender
, P2.nat p2_nat
, P2.photo p2_photo
, P2.taille p2_height
, P2.poids p2_weight
, R2.rank p2_rank
, R2.liveRank p2_rank_live
, P2.pro_depuis p2_turn_pro
, '?' p2_best_rank
, P2.prise p2_forehand
, P2.revers p2_backhand
, M.ts2 p2_seed
, P2B.id p2b_id
, P2B.nom p2b_name
, P2B.prenom p2b_first_name
, P2B.name_zh p2b_name_zh
, P2B.birthday p2b_birthday
, P2B.sexe p2b_gender
, P2B.nat p2b_nat
, P2B.photo p2b_photo
, P2B.taille p2b_height
, P2B.poids p2b_weight
, R2B.rank p2b_rank
, R2B.liveRank p2b_rank_live
, P2B.pro_depuis p2b_turn_pro
, T.id tournament_id
, T.idt tournament_idt
, '?' rencontre_id
, N.name_fr tournament_name_fr
, N.name_en tournament_name_en
, N.name_zh tournament_name_zh
, N.name_de tournament_name_de
, N.name_es tournament_name_es
, T.ville tournament_city
, T.stade tournament_stadium
, T.surface tournament_surface
, T.surface_photo tournament_surface_photo
, T.surface_color tournament_surface_color
, T.monnaie tournament_currency
, T.prix tournament_prize_money
, SCO.nom_fr tournament_country
, T.logo tournament_logo
, T.debut tournament_start
, T.fin tournament_end
, T.nbj tournament_nbPlayer
, T.genre tournament_genre
, T.category tournament_category
, T.type tournament_type
, T.ids tournament_site
, T.year tournament_year
, T.importance tournament_importance
, '' team1
, '' team2
, T.importance
, T.background tournament_background
, SC.fuseau_horaire
, IF(ISNULL(LS.status) || M.status = 2 || M.status = 3 || M.status = 4, M.status, LS.status) match_status
, LS.serve
, S.time s_time_start
, S.court
, S.date_loc
, S.type s_type
, S.ordre s_order
, C.nom court_name
, C.ordre court_order
FROM
tournois_matchs M
INNER JOIN joueurs P1 on P1.id = M.j1
LEFT OUTER JOIN `joueurs` P1B on P1B.id = M.j1_bis
INNER JOIN joueurs P2 on P2.id = M.j2
LEFT OUTER JOIN `joueurs` P2B on P2B.id = M.j2_bis
LEFT JOIN tennis_rankings R1 on R1.player = P1.id AND R1.id = IF(P1.sexe = 1, 'wta', 'atp')
LEFT JOIN tennis_rankings R1B on R1B.player = P1B.id AND R1B.id = IF(P1B.sexe = 1, 'wta', 'atp')
LEFT JOIN tennis_rankings R2 on R2.player = P2.id AND R2.id = IF(P2.sexe = 1, 'wta', 'atp')
LEFT JOIN tennis_rankings R2B on R2B.player = P2B.id AND R2B.id = IF(P2B.sexe = 1, 'wta', 'atp')
INNER JOIN tournois T on T.id = M.idt
INNER JOIN tournois_name N on N.id = T.id && N.cup = 0
LEFT OUTER JOIN lieux_sites SL on T.ids = SL.id
LEFT OUTER JOIN lieux_villes SC on SL.idv = SC.id
LEFT OUTER JOIN lieux_pays SCO on SCO.code = SC.pays
LEFT OUTER JOIN `livescores_new`.`matchs` LS on LS.tt_match_id = M.id
LEFT OUTER JOIN tournois_programmes S on S.idm = M.id
LEFT OUTER JOIN lieux_courts C on C.ids = S.ids && C.ordre = S.court
WHERE
M.id = '9431600'
&& M.type_tournoi_add = 0
&& (S.statut = 0 || S.statut = 4 || S.statut = 2 || ISNULL(S.statut))
UNION
SELECT
M.*
, M.time_start time_start
, M.time time_end
, M.duration_pause
, M.type_match_add type_match
, M.type_tournoi_add type_tournament
, CR.niveau level
, M.qualif
, M.idw winner_id
, P1.id p1_id
, P1.nom p1_name
, P1.prenom p1_first_name
, P1.name_zh p1_name_zh
, P1.birthday p1_birthday
, P1.sexe p1_gender
, P1.nat p1_nat
, P1.photo p1_photo
, P1.taille p1_height
, P1.poids p1_weight
, R1.rank p1_rank
, R1.liveRank p1_rank_live
, P1.pro_depuis p1_turn_pro
, '?' p1_best_rank
, P1.prise p1_forehand
, P1.revers p1_backhand
, M.ts1 p1_seed
, P1B.id p1b_id
, P1B.nom p1b_name
, P1B.prenom p1b_first_name
, P1B.name_zh p1b_name_zh
, P1B.birthday p1b_birthday
, P1B.sexe p1b_gender
, P1B.nat p1b_nat
, P1B.photo p1b_photo
, P1B.taille p1b_height
, P1B.poids p1b_weight
, R1B.rank p1b_rank
, R1B.liveRank p1b_rank_live
, P1B.pro_depuis p1b_turn_pro
, P2.id p2_id
, P2.nom p2_name
, P2.prenom p2_first_name
, P2.name_zh p2_name_zh
, P2.birthday p2_birthday
, P2.sexe p2_gender
, P2.nat p2_nat
, P2.photo p2_photo
, P2.taille p2_height
, P2.poids p2_weight
, R2.rank p2_rank
, R2.liveRank p2_rank_live
, P2.pro_depuis p2_turn_pro
, '?' p2_best_rank
, P2.prise p2_forehand
, P2.revers p2_backhand
, M.ts2 p2_seed
, P2B.id p2b_id
, P2B.nom p2b_name
, P2B.prenom p2b_first_name
, P2B.name_zh p2b_name_zh
, P2B.birthday p2b_birthday
, P2B.sexe p2b_gender
, P2B.nat p2b_nat
, P2B.photo p2b_photo
, P2B.taille p2b_height
, P2B.poids p2b_weight
, R2B.rank p2b_rank
, R2B.liveRank p2b_rank_live
, P2B.pro_depuis p2b_turn_pro
, C.id tournament_id
, C.parent tournament_idt
, CR.id rencontre_id
, N.name_fr tournament_name_fr
, N.name_en tournament_name_en
, N.name_zh tournament_name_zh
, N.name_de tournament_name_de
, N.name_es tournament_name_es
, CONCAT(CR.equipe_domicile, '|', CR.equipe_exterieur) tournament_city
, '' tournament_stadium
, CR.surface tournament_surface
, '' tournament_surface_photo
, '0' tournament_surface_color
, '' tournament_currency
, '' tournament_prize_money
, SCO.nom_fr tournament_country
, '' tournament_logo
, CR.date_d tournament_start
, '' tournament_end
, C.nbj tournament_nbPlayer
, '' tournament_genre
, '' tournament_category
, '' tournament_type
, CR.lieu tournament_site
, '' tournament_year
, 65 tournament_importance
, IF(T1.nom_fr, T1.nom_fr, CR.equipe_domicile) team1
, IF(T2.nom_fr, T1.nom_fr, CR.equipe_exterieur) team2
, 65 importance
, '' tournament_background
, SC.fuseau_horaire
, IF(ISNULL(LS.status) || M.status = 2 || M.status = 3 || M.status = 4, M.status, LS.status) match_status
, LS.serve
, S.time s_time_start
, S.court
, S.date_loc
, S.type s_type
, S.ordre s_order
, CT.nom court_name
, CT.ordre court_order
FROM
tournois_matchs M
INNER JOIN joueurs P1 on P1.id = M.j1
LEFT OUTER JOIN `joueurs` P1B on P1B.id = M.j1_bis
INNER JOIN joueurs P2 on P2.id = M.j2
LEFT OUTER JOIN `joueurs` P2B on P2B.id = M.j2_bis
LEFT JOIN tennis_rankings R1 on R1.player = P1.id AND R1.id = IF(P1.sexe = 1, 'wta', 'atp')
LEFT JOIN tennis_rankings R1B on R1B.player = P1B.id AND R1B.id = IF(P1B.sexe = 1, 'wta', 'atp')
LEFT JOIN tennis_rankings R2 on R2.player = P2.id AND R2.id = IF(P2.sexe = 1, 'wta', 'atp')
LEFT JOIN tennis_rankings R2B on R2B.player = P2B.id AND R2B.id = IF(P2B.sexe = 1, 'wta', 'atp')
LEFT OUTER JOIN `livescores_new`.`matchs` LS ON (LS.tt_match_id = M.id)
LEFT OUTER JOIN tournois_programmes S on S.idm = M.id
LEFT OUTER JOIN lieux_courts CT on (CT.ids = S.ids && CT.ordre = S.court)
INNER JOIN `coupes_rencontres` CR on CR.id = M.idt
INNER JOIN `coupes` C on C.id = CR.coupe_id
INNER JOIN tournois_name N on N.id = C.id
LEFT JOIN lieux_sites SL on SL.id = CR.lieu
LEFT JOIN lieux_villes SC on SC.id = SL.idv
LEFT JOIN lieux_pays SCO on SCO.code = SC.pays
LEFT JOIN `lieux_pays` T1 ON (T1.code = CR.equipe_domicile)
LEFT JOIN `lieux_pays` T2 ON (T2.code = CR.equipe_exterieur)
WHERE
M.id = '9431600'
&& M.type_tournoi_add = 1
&& (S.statut = 0 || S.statut = 4 || S.statut = 2 || ISNULL(S.statut))
UNION
SELECT
M.*
, M.time_start time_start
, M.time time_end
, M.duration_pause
, M.type_match_add type_match
, M.type_tournoi_add type_tournament
, '' level
, M.qualif
, M.idw winner_id
, P1.id p1_id
, P1.nom p1_name
, P1.prenom p1_first_name
, P1.name_zh p1_name_zh
, P1.birthday p1_birthday
, P1.sexe p1_gender
, P1.nat p1_nat
, P1.photo p1_photo
, P1.taille p1_height
, P1.poids p1_weight
, R1.rank p1_rank
, R1.liveRank p1_rank_live
, P1.pro_depuis p1_turn_pro
, '?' p1_best_rank
, P1.prise p1_forehand
, P1.revers p1_backhand
, M.ts1 p1_seed
, P1B.id p1b_id
, P1B.nom p1b_name
, P1B.prenom p1b_first_name
, P1B.name_zh p1b_name_zh
, P1B.birthday p1b_birthday
, P1B.sexe p1b_gender
, P1B.nat p1b_nat
, P1B.photo p1b_photo
, P1B.taille p1b_height
, P1B.poids p1b_weight
, R1B.rank p1b_rank
, R1B.liveRank p1b_rank_live
, P1B.pro_depuis p1b_turn_pro
, P2.id p2_id
, P2.nom p2_name
, P2.prenom p2_first_name
, P2.name_zh p2_name_zh
, P2.birthday p2_birthday
, P2.sexe p2_gender
, P2.nat p2_nat
, P2.photo p2_photo
, P2.taille p2_height
, P2.poids p2_weight
, R2.rank p2_rank
, R2.liveRank p2_rank_live
, P2.pro_depuis p2_turn_pro
, '?' p2_best_rank
, P2.prise p2_forehand
, P2.revers p2_backhand
, M.ts2 p2_seed
, P2B.id p2b_id
, P2B.nom p2b_name
, P2B.prenom p2b_first_name
, P2B.name_zh p2b_name_zh
, P2B.birthday p2b_birthday
, P2B.sexe p2b_gender
, P2B.nat p2b_nat
, P2B.photo p2b_photo
, P2B.taille p2b_height
, P2B.poids p2b_weight
, R2B.rank p2b_rank
, R2B.liveRank p2b_rank_live
, P2B.pro_depuis p2b_turn_pro
, L.id tournament_id
, 0 tournament_idt
, LR.id rencontre_id
, N.name_fr tournament_name_fr
, N.name_en tournament_name_en
, N.name_zh tournament_name_zh
, N.name_de tournament_name_de
, N.name_es tournament_name_es
, SC.nom tournament_city
, '' tournament_stadium
, '3' tournament_surface
, '' tournament_surface_photo
, '0' tournament_surface_color
, '' tournament_currency
, '' tournament_prize_money
, SCO.nom_fr tournament_country
, '' tournament_logo
, L.time_start tournament_start
, '' tournament_end
, '' tournament_nbPlayer
, '' tournament_genre
, '' tournament_category
, '' tournament_type
, LR.site tournament_site
, L.year tournament_year
, 0 tournament_importance
, '' team1
, '' team2
, 3 importance
, '' tournament_background
, SC.fuseau_horaire
, IF(ISNULL(LS.status) || M.status = 2 || M.status = 3 || M.status = 4, M.status, LS.status) match_status
, LS.serve
, S.time s_time_start
, S.court
, S.date_loc
, S.type s_type
, S.ordre s_order
, CT.nom court_name
, CT.ordre court_order
FROM
tournois_matchs M
JOIN joueurs P1 on P1.id = M.j1
LEFT JOIN `joueurs` P1B on P1B.id = M.j1_bis
JOIN joueurs P2 on P2.id = M.j2
LEFT JOIN `joueurs` P2B on P2B.id = M.j2_bis
LEFT JOIN tennis_rankings R1 on R1.player = P1.id AND R1.id = IF(P1.sexe = 1, 'wta', 'atp')
LEFT JOIN tennis_rankings R1B on R1B.player = P1B.id AND R1B.id = IF(P1B.sexe = 1, 'wta', 'atp')
LEFT JOIN tennis_rankings R2 on R2.player = P2.id AND R2.id = IF(P2.sexe = 1, 'wta', 'atp')
LEFT JOIN tennis_rankings R2B on R2B.player = P2B.id AND R2B.id = IF(P2B.sexe = 1, 'wta', 'atp')
LEFT JOIN `livescores_new`.`matchs` LS ON (LS.tt_match_id = M.id)
LEFT JOIN tournois_programmes S on S.idm = M.id
LEFT JOIN lieux_courts CT on (CT.ids = S.ids && CT.ordre = S.court)
JOIN `leagues_rounds` LR on LR.id = M.league_round
JOIN `leagues` L on L.id = LR.league
JOIN tournois_name N on N.league = L.id
LEFT JOIN lieux_sites SL on SL.id = LR.site
LEFT JOIN lieux_villes SC on SC.id = SL.idv
LEFT JOIN lieux_pays SCO on SCO.code = SC.pays
WHERE
M.id = '9431600'
&& M.type_tournoi_add = 2
&& (S.statut = 0 || S.statut = 4 || S.statut = 2 || ISNULL(S.statut))
LIMIT 1
SELECT M.*
, M.time_start time_start
, M.time time_end
, M.duration_pause
, M.type_match_add type_match
, M.type_tournoi_add type_tournament
, M.niveau level
, M.qualif
, M.idw winner_id
, P1.id p1_id
, P1.nom p1_name
, P1.prenom p1_first_name
, P1.name_zh p1_name_zh
, P1.birthday p1_birthday
, P1.sexe p1_gender
, P1.nat p1_nat
, P1.photo p1_photo
, P1.taille p1_height
, P1.poids p1_weight
, R1.rank p1_rank
, R1.liveRank p1_rank_live
, P1.pro_depuis p1_turn_pro
, '?' p1_best_rank
, P1.prise p1_forehand
, P1.revers p1_backhand
, M.ts1 p1_seed
, P1B.id p1b_id
, P1B.nom p1b_name
, P1B.prenom p1b_first_name
, P1B.name_zh p1b_name_zh
, P1B.birthday p1b_birthday
, P1B.sexe p1b_gender
, P1B.nat p1b_nat
, P1B.photo p1b_photo
, P1B.taille p1b_height
, P1B.poids p1b_weight
, R1B.rank p1b_rank
, R1B.liveRank p1b_rank_live
, P1B.pro_depuis p1b_turn_pro
, P2.id p2_id
, P2.nom p2_name
, P2.prenom p2_first_name
, P2.name_zh p2_name_zh
, P2.birthday p2_birthday
, P2.sexe p2_gender
, P2.nat p2_nat
, P2.photo p2_photo
, P2.taille p2_height
, P2.poids p2_weight
, R2.rank p2_rank
, R2.liveRank p2_rank_live
, P2.pro_depuis p2_turn_pro
, '?' p2_best_rank
, P2.prise p2_forehand
, P2.revers p2_backhand
, M.ts2 p2_seed
, P2B.id p2b_id
, P2B.nom p2b_name
, P2B.prenom p2b_first_name
, P2B.name_zh p2b_name_zh
, P2B.birthday p2b_birthday
, P2B.sexe p2b_gender
, P2B.nat p2b_nat
, P2B.photo p2b_photo
, P2B.taille p2b_height
, P2B.poids p2b_weight
, R2B.rank p2b_rank
, R2B.liveRank p2b_rank_live
, P2B.pro_depuis p2b_turn_pro
, T.id tournament_id
, T.idt tournament_idt
, '?' rencontre_id
, N.name_fr tournament_name_fr
, N.name_en tournament_name_en
, N.name_zh tournament_name_zh
, N.name_de tournament_name_de
, N.name_es tournament_name_es
, T.ville tournament_city
, T.stade tournament_stadium
, T.surface tournament_surface
, T.surface_photo tournament_surface_photo
, T.surface_color tournament_surface_color
, T.monnaie tournament_currency
, T.prix tournament_prize_money
, SCO.nom_fr tournament_country
, T.logo tournament_logo
, T.debut tournament_start
, T.fin tournament_end
, T.nbj tournament_nbPlayer
, T.genre tournament_genre
, T.category tournament_category
, T.type tournament_type
, T.ids tournament_site
, T.year tournament_year
, T.importance tournament_importance
, '' team1
, '' team2
, T.importance
, T.background tournament_background
, SC.fuseau_horaire
, IF(ISNULL(LS.status) || M.status = 2 || M.status = 3 || M.status = 4, M.status, LS.status) match_status
, LS.serve
, S.time s_time_start
, S.court
, S.date_loc
, S.type s_type
, S.ordre s_order
, C.nom court_name
, C.ordre court_order
FROM
tournois_matchs M
INNER JOIN joueurs P1 on P1.id = M.j1
LEFT OUTER JOIN `joueurs` P1B on P1B.id = M.j1_bis
INNER JOIN joueurs P2 on P2.id = M.j2
LEFT OUTER JOIN `joueurs` P2B on P2B.id = M.j2_bis
LEFT JOIN tennis_rankings R1 on R1.player = P1.id AND R1.id = IF(P1.sexe = 1, 'wta', 'atp')
LEFT JOIN tennis_rankings R1B on R1B.player = P1B.id AND R1B.id = IF(P1B.sexe = 1, 'wta', 'atp')
LEFT JOIN tennis_rankings R2 on R2.player = P2.id AND R2.id = IF(P2.sexe = 1, 'wta', 'atp')
LEFT JOIN tennis_rankings R2B on R2B.player = P2B.id AND R2B.id = IF(P2B.sexe = 1, 'wta', 'atp')
INNER JOIN tournois T on T.id = M.idt
INNER JOIN tournois_name N on N.id = T.id && N.cup = 0
LEFT OUTER JOIN lieux_sites SL on T.ids = SL.id
LEFT OUTER JOIN lieux_villes SC on SL.idv = SC.id
LEFT OUTER JOIN lieux_pays SCO on SCO.code = SC.pays
LEFT OUTER JOIN `livescores_new`.`matchs` LS on LS.tt_match_id = M.id
LEFT OUTER JOIN tournois_programmes S on S.idm = M.id
LEFT OUTER JOIN lieux_courts C on C.ids = S.ids && C.ordre = S.court
WHERE
M.id = '9431631'
&& M.type_tournoi_add = 0
&& (S.statut = 0 || S.statut = 4 || S.statut = 2 || ISNULL(S.statut))
UNION
SELECT
M.*
, M.time_start time_start
, M.time time_end
, M.duration_pause
, M.type_match_add type_match
, M.type_tournoi_add type_tournament
, CR.niveau level
, M.qualif
, M.idw winner_id
, P1.id p1_id
, P1.nom p1_name
, P1.prenom p1_first_name
, P1.name_zh p1_name_zh
, P1.birthday p1_birthday
, P1.sexe p1_gender
, P1.nat p1_nat
, P1.photo p1_photo
, P1.taille p1_height
, P1.poids p1_weight
, R1.rank p1_rank
, R1.liveRank p1_rank_live
, P1.pro_depuis p1_turn_pro
, '?' p1_best_rank
, P1.prise p1_forehand
, P1.revers p1_backhand
, M.ts1 p1_seed
, P1B.id p1b_id
, P1B.nom p1b_name
, P1B.prenom p1b_first_name
, P1B.name_zh p1b_name_zh
, P1B.birthday p1b_birthday
, P1B.sexe p1b_gender
, P1B.nat p1b_nat
, P1B.photo p1b_photo
, P1B.taille p1b_height
, P1B.poids p1b_weight
, R1B.rank p1b_rank
, R1B.liveRank p1b_rank_live
, P1B.pro_depuis p1b_turn_pro
, P2.id p2_id
, P2.nom p2_name
, P2.prenom p2_first_name
, P2.name_zh p2_name_zh
, P2.birthday p2_birthday
, P2.sexe p2_gender
, P2.nat p2_nat
, P2.photo p2_photo
, P2.taille p2_height
, P2.poids p2_weight
, R2.rank p2_rank
, R2.liveRank p2_rank_live
, P2.pro_depuis p2_turn_pro
, '?' p2_best_rank
, P2.prise p2_forehand
, P2.revers p2_backhand
, M.ts2 p2_seed
, P2B.id p2b_id
, P2B.nom p2b_name
, P2B.prenom p2b_first_name
, P2B.name_zh p2b_name_zh
, P2B.birthday p2b_birthday
, P2B.sexe p2b_gender
, P2B.nat p2b_nat
, P2B.photo p2b_photo
, P2B.taille p2b_height
, P2B.poids p2b_weight
, R2B.rank p2b_rank
, R2B.liveRank p2b_rank_live
, P2B.pro_depuis p2b_turn_pro
, C.id tournament_id
, C.parent tournament_idt
, CR.id rencontre_id
, N.name_fr tournament_name_fr
, N.name_en tournament_name_en
, N.name_zh tournament_name_zh
, N.name_de tournament_name_de
, N.name_es tournament_name_es
, CONCAT(CR.equipe_domicile, '|', CR.equipe_exterieur) tournament_city
, '' tournament_stadium
, CR.surface tournament_surface
, '' tournament_surface_photo
, '0' tournament_surface_color
, '' tournament_currency
, '' tournament_prize_money
, SCO.nom_fr tournament_country
, '' tournament_logo
, CR.date_d tournament_start
, '' tournament_end
, C.nbj tournament_nbPlayer
, '' tournament_genre
, '' tournament_category
, '' tournament_type
, CR.lieu tournament_site
, '' tournament_year
, 65 tournament_importance
, IF(T1.nom_fr, T1.nom_fr, CR.equipe_domicile) team1
, IF(T2.nom_fr, T1.nom_fr, CR.equipe_exterieur) team2
, 65 importance
, '' tournament_background
, SC.fuseau_horaire
, IF(ISNULL(LS.status) || M.status = 2 || M.status = 3 || M.status = 4, M.status, LS.status) match_status
, LS.serve
, S.time s_time_start
, S.court
, S.date_loc
, S.type s_type
, S.ordre s_order
, CT.nom court_name
, CT.ordre court_order
FROM
tournois_matchs M
INNER JOIN joueurs P1 on P1.id = M.j1
LEFT OUTER JOIN `joueurs` P1B on P1B.id = M.j1_bis
INNER JOIN joueurs P2 on P2.id = M.j2
LEFT OUTER JOIN `joueurs` P2B on P2B.id = M.j2_bis
LEFT JOIN tennis_rankings R1 on R1.player = P1.id AND R1.id = IF(P1.sexe = 1, 'wta', 'atp')
LEFT JOIN tennis_rankings R1B on R1B.player = P1B.id AND R1B.id = IF(P1B.sexe = 1, 'wta', 'atp')
LEFT JOIN tennis_rankings R2 on R2.player = P2.id AND R2.id = IF(P2.sexe = 1, 'wta', 'atp')
LEFT JOIN tennis_rankings R2B on R2B.player = P2B.id AND R2B.id = IF(P2B.sexe = 1, 'wta', 'atp')
LEFT OUTER JOIN `livescores_new`.`matchs` LS ON (LS.tt_match_id = M.id)
LEFT OUTER JOIN tournois_programmes S on S.idm = M.id
LEFT OUTER JOIN lieux_courts CT on (CT.ids = S.ids && CT.ordre = S.court)
INNER JOIN `coupes_rencontres` CR on CR.id = M.idt
INNER JOIN `coupes` C on C.id = CR.coupe_id
INNER JOIN tournois_name N on N.id = C.id
LEFT JOIN lieux_sites SL on SL.id = CR.lieu
LEFT JOIN lieux_villes SC on SC.id = SL.idv
LEFT JOIN lieux_pays SCO on SCO.code = SC.pays
LEFT JOIN `lieux_pays` T1 ON (T1.code = CR.equipe_domicile)
LEFT JOIN `lieux_pays` T2 ON (T2.code = CR.equipe_exterieur)
WHERE
M.id = '9431631'
&& M.type_tournoi_add = 1
&& (S.statut = 0 || S.statut = 4 || S.statut = 2 || ISNULL(S.statut))
UNION
SELECT
M.*
, M.time_start time_start
, M.time time_end
, M.duration_pause
, M.type_match_add type_match
, M.type_tournoi_add type_tournament
, '' level
, M.qualif
, M.idw winner_id
, P1.id p1_id
, P1.nom p1_name
, P1.prenom p1_first_name
, P1.name_zh p1_name_zh
, P1.birthday p1_birthday
, P1.sexe p1_gender
, P1.nat p1_nat
, P1.photo p1_photo
, P1.taille p1_height
, P1.poids p1_weight
, R1.rank p1_rank
, R1.liveRank p1_rank_live
, P1.pro_depuis p1_turn_pro
, '?' p1_best_rank
, P1.prise p1_forehand
, P1.revers p1_backhand
, M.ts1 p1_seed
, P1B.id p1b_id
, P1B.nom p1b_name
, P1B.prenom p1b_first_name
, P1B.name_zh p1b_name_zh
, P1B.birthday p1b_birthday
, P1B.sexe p1b_gender
, P1B.nat p1b_nat
, P1B.photo p1b_photo
, P1B.taille p1b_height
, P1B.poids p1b_weight
, R1B.rank p1b_rank
, R1B.liveRank p1b_rank_live
, P1B.pro_depuis p1b_turn_pro
, P2.id p2_id
, P2.nom p2_name
, P2.prenom p2_first_name
, P2.name_zh p2_name_zh
, P2.birthday p2_birthday
, P2.sexe p2_gender
, P2.nat p2_nat
, P2.photo p2_photo
, P2.taille p2_height
, P2.poids p2_weight
, R2.rank p2_rank
, R2.liveRank p2_rank_live
, P2.pro_depuis p2_turn_pro
, '?' p2_best_rank
, P2.prise p2_forehand
, P2.revers p2_backhand
, M.ts2 p2_seed
, P2B.id p2b_id
, P2B.nom p2b_name
, P2B.prenom p2b_first_name
, P2B.name_zh p2b_name_zh
, P2B.birthday p2b_birthday
, P2B.sexe p2b_gender
, P2B.nat p2b_nat
, P2B.photo p2b_photo
, P2B.taille p2b_height
, P2B.poids p2b_weight
, R2B.rank p2b_rank
, R2B.liveRank p2b_rank_live
, P2B.pro_depuis p2b_turn_pro
, L.id tournament_id
, 0 tournament_idt
, LR.id rencontre_id
, N.name_fr tournament_name_fr
, N.name_en tournament_name_en
, N.name_zh tournament_name_zh
, N.name_de tournament_name_de
, N.name_es tournament_name_es
, SC.nom tournament_city
, '' tournament_stadium
, '3' tournament_surface
, '' tournament_surface_photo
, '0' tournament_surface_color
, '' tournament_currency
, '' tournament_prize_money
, SCO.nom_fr tournament_country
, '' tournament_logo
, L.time_start tournament_start
, '' tournament_end
, '' tournament_nbPlayer
, '' tournament_genre
, '' tournament_category
, '' tournament_type
, LR.site tournament_site
, L.year tournament_year
, 0 tournament_importance
, '' team1
, '' team2
, 3 importance
, '' tournament_background
, SC.fuseau_horaire
, IF(ISNULL(LS.status) || M.status = 2 || M.status = 3 || M.status = 4, M.status, LS.status) match_status
, LS.serve
, S.time s_time_start
, S.court
, S.date_loc
, S.type s_type
, S.ordre s_order
, CT.nom court_name
, CT.ordre court_order
FROM
tournois_matchs M
JOIN joueurs P1 on P1.id = M.j1
LEFT JOIN `joueurs` P1B on P1B.id = M.j1_bis
JOIN joueurs P2 on P2.id = M.j2
LEFT JOIN `joueurs` P2B on P2B.id = M.j2_bis
LEFT JOIN tennis_rankings R1 on R1.player = P1.id AND R1.id = IF(P1.sexe = 1, 'wta', 'atp')
LEFT JOIN tennis_rankings R1B on R1B.player = P1B.id AND R1B.id = IF(P1B.sexe = 1, 'wta', 'atp')
LEFT JOIN tennis_rankings R2 on R2.player = P2.id AND R2.id = IF(P2.sexe = 1, 'wta', 'atp')
LEFT JOIN tennis_rankings R2B on R2B.player = P2B.id AND R2B.id = IF(P2B.sexe = 1, 'wta', 'atp')
LEFT JOIN `livescores_new`.`matchs` LS ON (LS.tt_match_id = M.id)
LEFT JOIN tournois_programmes S on S.idm = M.id
LEFT JOIN lieux_courts CT on (CT.ids = S.ids && CT.ordre = S.court)
JOIN `leagues_rounds` LR on LR.id = M.league_round
JOIN `leagues` L on L.id = LR.league
JOIN tournois_name N on N.league = L.id
LEFT JOIN lieux_sites SL on SL.id = LR.site
LEFT JOIN lieux_villes SC on SC.id = SL.idv
LEFT JOIN lieux_pays SCO on SCO.code = SC.pays
WHERE
M.id = '9431631'
&& M.type_tournoi_add = 2
&& (S.statut = 0 || S.statut = 4 || S.statut = 2 || ISNULL(S.statut))
LIMIT 1
SELECT M.*
, M.time_start time_start
, M.time time_end
, M.duration_pause
, M.type_match_add type_match
, M.type_tournoi_add type_tournament
, M.niveau level
, M.qualif
, M.idw winner_id
, P1.id p1_id
, P1.nom p1_name
, P1.prenom p1_first_name
, P1.name_zh p1_name_zh
, P1.birthday p1_birthday
, P1.sexe p1_gender
, P1.nat p1_nat
, P1.photo p1_photo
, P1.taille p1_height
, P1.poids p1_weight
, R1.rank p1_rank
, R1.liveRank p1_rank_live
, P1.pro_depuis p1_turn_pro
, '?' p1_best_rank
, P1.prise p1_forehand
, P1.revers p1_backhand
, M.ts1 p1_seed
, P1B.id p1b_id
, P1B.nom p1b_name
, P1B.prenom p1b_first_name
, P1B.name_zh p1b_name_zh
, P1B.birthday p1b_birthday
, P1B.sexe p1b_gender
, P1B.nat p1b_nat
, P1B.photo p1b_photo
, P1B.taille p1b_height
, P1B.poids p1b_weight
, R1B.rank p1b_rank
, R1B.liveRank p1b_rank_live
, P1B.pro_depuis p1b_turn_pro
, P2.id p2_id
, P2.nom p2_name
, P2.prenom p2_first_name
, P2.name_zh p2_name_zh
, P2.birthday p2_birthday
, P2.sexe p2_gender
, P2.nat p2_nat
, P2.photo p2_photo
, P2.taille p2_height
, P2.poids p2_weight
, R2.rank p2_rank
, R2.liveRank p2_rank_live
, P2.pro_depuis p2_turn_pro
, '?' p2_best_rank
, P2.prise p2_forehand
, P2.revers p2_backhand
, M.ts2 p2_seed
, P2B.id p2b_id
, P2B.nom p2b_name
, P2B.prenom p2b_first_name
, P2B.name_zh p2b_name_zh
, P2B.birthday p2b_birthday
, P2B.sexe p2b_gender
, P2B.nat p2b_nat
, P2B.photo p2b_photo
, P2B.taille p2b_height
, P2B.poids p2b_weight
, R2B.rank p2b_rank
, R2B.liveRank p2b_rank_live
, P2B.pro_depuis p2b_turn_pro
, T.id tournament_id
, T.idt tournament_idt
, '?' rencontre_id
, N.name_fr tournament_name_fr
, N.name_en tournament_name_en
, N.name_zh tournament_name_zh
, N.name_de tournament_name_de
, N.name_es tournament_name_es
, T.ville tournament_city
, T.stade tournament_stadium
, T.surface tournament_surface
, T.surface_photo tournament_surface_photo
, T.surface_color tournament_surface_color
, T.monnaie tournament_currency
, T.prix tournament_prize_money
, SCO.nom_fr tournament_country
, T.logo tournament_logo
, T.debut tournament_start
, T.fin tournament_end
, T.nbj tournament_nbPlayer
, T.genre tournament_genre
, T.category tournament_category
, T.type tournament_type
, T.ids tournament_site
, T.year tournament_year
, T.importance tournament_importance
, '' team1
, '' team2
, T.importance
, T.background tournament_background
, SC.fuseau_horaire
, IF(ISNULL(LS.status) || M.status = 2 || M.status = 3 || M.status = 4, M.status, LS.status) match_status
, LS.serve
, S.time s_time_start
, S.court
, S.date_loc
, S.type s_type
, S.ordre s_order
, C.nom court_name
, C.ordre court_order
FROM
tournois_matchs M
INNER JOIN joueurs P1 on P1.id = M.j1
LEFT OUTER JOIN `joueurs` P1B on P1B.id = M.j1_bis
INNER JOIN joueurs P2 on P2.id = M.j2
LEFT OUTER JOIN `joueurs` P2B on P2B.id = M.j2_bis
LEFT JOIN tennis_rankings R1 on R1.player = P1.id AND R1.id = IF(P1.sexe = 1, 'wta', 'atp')
LEFT JOIN tennis_rankings R1B on R1B.player = P1B.id AND R1B.id = IF(P1B.sexe = 1, 'wta', 'atp')
LEFT JOIN tennis_rankings R2 on R2.player = P2.id AND R2.id = IF(P2.sexe = 1, 'wta', 'atp')
LEFT JOIN tennis_rankings R2B on R2B.player = P2B.id AND R2B.id = IF(P2B.sexe = 1, 'wta', 'atp')
INNER JOIN tournois T on T.id = M.idt
INNER JOIN tournois_name N on N.id = T.id && N.cup = 0
LEFT OUTER JOIN lieux_sites SL on T.ids = SL.id
LEFT OUTER JOIN lieux_villes SC on SL.idv = SC.id
LEFT OUTER JOIN lieux_pays SCO on SCO.code = SC.pays
LEFT OUTER JOIN `livescores_new`.`matchs` LS on LS.tt_match_id = M.id
LEFT OUTER JOIN tournois_programmes S on S.idm = M.id
LEFT OUTER JOIN lieux_courts C on C.ids = S.ids && C.ordre = S.court
WHERE
M.id = '9431606'
&& M.type_tournoi_add = 0
&& (S.statut = 0 || S.statut = 4 || S.statut = 2 || ISNULL(S.statut))
UNION
SELECT
M.*
, M.time_start time_start
, M.time time_end
, M.duration_pause
, M.type_match_add type_match
, M.type_tournoi_add type_tournament
, CR.niveau level
, M.qualif
, M.idw winner_id
, P1.id p1_id
, P1.nom p1_name
, P1.prenom p1_first_name
, P1.name_zh p1_name_zh
, P1.birthday p1_birthday
, P1.sexe p1_gender
, P1.nat p1_nat
, P1.photo p1_photo
, P1.taille p1_height
, P1.poids p1_weight
, R1.rank p1_rank
, R1.liveRank p1_rank_live
, P1.pro_depuis p1_turn_pro
, '?' p1_best_rank
, P1.prise p1_forehand
, P1.revers p1_backhand
, M.ts1 p1_seed
, P1B.id p1b_id
, P1B.nom p1b_name
, P1B.prenom p1b_first_name
, P1B.name_zh p1b_name_zh
, P1B.birthday p1b_birthday
, P1B.sexe p1b_gender
, P1B.nat p1b_nat
, P1B.photo p1b_photo
, P1B.taille p1b_height
, P1B.poids p1b_weight
, R1B.rank p1b_rank
, R1B.liveRank p1b_rank_live
, P1B.pro_depuis p1b_turn_pro
, P2.id p2_id
, P2.nom p2_name
, P2.prenom p2_first_name
, P2.name_zh p2_name_zh
, P2.birthday p2_birthday
, P2.sexe p2_gender
, P2.nat p2_nat
, P2.photo p2_photo
, P2.taille p2_height
, P2.poids p2_weight
, R2.rank p2_rank
, R2.liveRank p2_rank_live
, P2.pro_depuis p2_turn_pro
, '?' p2_best_rank
, P2.prise p2_forehand
, P2.revers p2_backhand
, M.ts2 p2_seed
, P2B.id p2b_id
, P2B.nom p2b_name
, P2B.prenom p2b_first_name
, P2B.name_zh p2b_name_zh
, P2B.birthday p2b_birthday
, P2B.sexe p2b_gender
, P2B.nat p2b_nat
, P2B.photo p2b_photo
, P2B.taille p2b_height
, P2B.poids p2b_weight
, R2B.rank p2b_rank
, R2B.liveRank p2b_rank_live
, P2B.pro_depuis p2b_turn_pro
, C.id tournament_id
, C.parent tournament_idt
, CR.id rencontre_id
, N.name_fr tournament_name_fr
, N.name_en tournament_name_en
, N.name_zh tournament_name_zh
, N.name_de tournament_name_de
, N.name_es tournament_name_es
, CONCAT(CR.equipe_domicile, '|', CR.equipe_exterieur) tournament_city
, '' tournament_stadium
, CR.surface tournament_surface
, '' tournament_surface_photo
, '0' tournament_surface_color
, '' tournament_currency
, '' tournament_prize_money
, SCO.nom_fr tournament_country
, '' tournament_logo
, CR.date_d tournament_start
, '' tournament_end
, C.nbj tournament_nbPlayer
, '' tournament_genre
, '' tournament_category
, '' tournament_type
, CR.lieu tournament_site
, '' tournament_year
, 65 tournament_importance
, IF(T1.nom_fr, T1.nom_fr, CR.equipe_domicile) team1
, IF(T2.nom_fr, T1.nom_fr, CR.equipe_exterieur) team2
, 65 importance
, '' tournament_background
, SC.fuseau_horaire
, IF(ISNULL(LS.status) || M.status = 2 || M.status = 3 || M.status = 4, M.status, LS.status) match_status
, LS.serve
, S.time s_time_start
, S.court
, S.date_loc
, S.type s_type
, S.ordre s_order
, CT.nom court_name
, CT.ordre court_order
FROM
tournois_matchs M
INNER JOIN joueurs P1 on P1.id = M.j1
LEFT OUTER JOIN `joueurs` P1B on P1B.id = M.j1_bis
INNER JOIN joueurs P2 on P2.id = M.j2
LEFT OUTER JOIN `joueurs` P2B on P2B.id = M.j2_bis
LEFT JOIN tennis_rankings R1 on R1.player = P1.id AND R1.id = IF(P1.sexe = 1, 'wta', 'atp')
LEFT JOIN tennis_rankings R1B on R1B.player = P1B.id AND R1B.id = IF(P1B.sexe = 1, 'wta', 'atp')
LEFT JOIN tennis_rankings R2 on R2.player = P2.id AND R2.id = IF(P2.sexe = 1, 'wta', 'atp')
LEFT JOIN tennis_rankings R2B on R2B.player = P2B.id AND R2B.id = IF(P2B.sexe = 1, 'wta', 'atp')
LEFT OUTER JOIN `livescores_new`.`matchs` LS ON (LS.tt_match_id = M.id)
LEFT OUTER JOIN tournois_programmes S on S.idm = M.id
LEFT OUTER JOIN lieux_courts CT on (CT.ids = S.ids && CT.ordre = S.court)
INNER JOIN `coupes_rencontres` CR on CR.id = M.idt
INNER JOIN `coupes` C on C.id = CR.coupe_id
INNER JOIN tournois_name N on N.id = C.id
LEFT JOIN lieux_sites SL on SL.id = CR.lieu
LEFT JOIN lieux_villes SC on SC.id = SL.idv
LEFT JOIN lieux_pays SCO on SCO.code = SC.pays
LEFT JOIN `lieux_pays` T1 ON (T1.code = CR.equipe_domicile)
LEFT JOIN `lieux_pays` T2 ON (T2.code = CR.equipe_exterieur)
WHERE
M.id = '9431606'
&& M.type_tournoi_add = 1
&& (S.statut = 0 || S.statut = 4 || S.statut = 2 || ISNULL(S.statut))
UNION
SELECT
M.*
, M.time_start time_start
, M.time time_end
, M.duration_pause
, M.type_match_add type_match
, M.type_tournoi_add type_tournament
, '' level
, M.qualif
, M.idw winner_id
, P1.id p1_id
, P1.nom p1_name
, P1.prenom p1_first_name
, P1.name_zh p1_name_zh
, P1.birthday p1_birthday
, P1.sexe p1_gender
, P1.nat p1_nat
, P1.photo p1_photo
, P1.taille p1_height
, P1.poids p1_weight
, R1.rank p1_rank
, R1.liveRank p1_rank_live
, P1.pro_depuis p1_turn_pro
, '?' p1_best_rank
, P1.prise p1_forehand
, P1.revers p1_backhand
, M.ts1 p1_seed
, P1B.id p1b_id
, P1B.nom p1b_name
, P1B.prenom p1b_first_name
, P1B.name_zh p1b_name_zh
, P1B.birthday p1b_birthday
, P1B.sexe p1b_gender
, P1B.nat p1b_nat
, P1B.photo p1b_photo
, P1B.taille p1b_height
, P1B.poids p1b_weight
, R1B.rank p1b_rank
, R1B.liveRank p1b_rank_live
, P1B.pro_depuis p1b_turn_pro
, P2.id p2_id
, P2.nom p2_name
, P2.prenom p2_first_name
, P2.name_zh p2_name_zh
, P2.birthday p2_birthday
, P2.sexe p2_gender
, P2.nat p2_nat
, P2.photo p2_photo
, P2.taille p2_height
, P2.poids p2_weight
, R2.rank p2_rank
, R2.liveRank p2_rank_live
, P2.pro_depuis p2_turn_pro
, '?' p2_best_rank
, P2.prise p2_forehand
, P2.revers p2_backhand
, M.ts2 p2_seed
, P2B.id p2b_id
, P2B.nom p2b_name
, P2B.prenom p2b_first_name
, P2B.name_zh p2b_name_zh
, P2B.birthday p2b_birthday
, P2B.sexe p2b_gender
, P2B.nat p2b_nat
, P2B.photo p2b_photo
, P2B.taille p2b_height
, P2B.poids p2b_weight
, R2B.rank p2b_rank
, R2B.liveRank p2b_rank_live
, P2B.pro_depuis p2b_turn_pro
, L.id tournament_id
, 0 tournament_idt
, LR.id rencontre_id
, N.name_fr tournament_name_fr
, N.name_en tournament_name_en
, N.name_zh tournament_name_zh
, N.name_de tournament_name_de
, N.name_es tournament_name_es
, SC.nom tournament_city
, '' tournament_stadium
, '3' tournament_surface
, '' tournament_surface_photo
, '0' tournament_surface_color
, '' tournament_currency
, '' tournament_prize_money
, SCO.nom_fr tournament_country
, '' tournament_logo
, L.time_start tournament_start
, '' tournament_end
, '' tournament_nbPlayer
, '' tournament_genre
, '' tournament_category
, '' tournament_type
, LR.site tournament_site
, L.year tournament_year
, 0 tournament_importance
, '' team1
, '' team2
, 3 importance
, '' tournament_background
, SC.fuseau_horaire
, IF(ISNULL(LS.status) || M.status = 2 || M.status = 3 || M.status = 4, M.status, LS.status) match_status
, LS.serve
, S.time s_time_start
, S.court
, S.date_loc
, S.type s_type
, S.ordre s_order
, CT.nom court_name
, CT.ordre court_order
FROM
tournois_matchs M
JOIN joueurs P1 on P1.id = M.j1
LEFT JOIN `joueurs` P1B on P1B.id = M.j1_bis
JOIN joueurs P2 on P2.id = M.j2
LEFT JOIN `joueurs` P2B on P2B.id = M.j2_bis
LEFT JOIN tennis_rankings R1 on R1.player = P1.id AND R1.id = IF(P1.sexe = 1, 'wta', 'atp')
LEFT JOIN tennis_rankings R1B on R1B.player = P1B.id AND R1B.id = IF(P1B.sexe = 1, 'wta', 'atp')
LEFT JOIN tennis_rankings R2 on R2.player = P2.id AND R2.id = IF(P2.sexe = 1, 'wta', 'atp')
LEFT JOIN tennis_rankings R2B on R2B.player = P2B.id AND R2B.id = IF(P2B.sexe = 1, 'wta', 'atp')
LEFT JOIN `livescores_new`.`matchs` LS ON (LS.tt_match_id = M.id)
LEFT JOIN tournois_programmes S on S.idm = M.id
LEFT JOIN lieux_courts CT on (CT.ids = S.ids && CT.ordre = S.court)
JOIN `leagues_rounds` LR on LR.id = M.league_round
JOIN `leagues` L on L.id = LR.league
JOIN tournois_name N on N.league = L.id
LEFT JOIN lieux_sites SL on SL.id = LR.site
LEFT JOIN lieux_villes SC on SC.id = SL.idv
LEFT JOIN lieux_pays SCO on SCO.code = SC.pays
WHERE
M.id = '9431606'
&& M.type_tournoi_add = 2
&& (S.statut = 0 || S.statut = 4 || S.statut = 2 || ISNULL(S.statut))
LIMIT 1
SELECT M.*
, M.time_start time_start
, M.time time_end
, M.duration_pause
, M.type_match_add type_match
, M.type_tournoi_add type_tournament
, M.niveau level
, M.qualif
, M.idw winner_id
, P1.id p1_id
, P1.nom p1_name
, P1.prenom p1_first_name
, P1.name_zh p1_name_zh
, P1.birthday p1_birthday
, P1.sexe p1_gender
, P1.nat p1_nat
, P1.photo p1_photo
, P1.taille p1_height
, P1.poids p1_weight
, R1.rank p1_rank
, R1.liveRank p1_rank_live
, P1.pro_depuis p1_turn_pro
, '?' p1_best_rank
, P1.prise p1_forehand
, P1.revers p1_backhand
, M.ts1 p1_seed
, P1B.id p1b_id
, P1B.nom p1b_name
, P1B.prenom p1b_first_name
, P1B.name_zh p1b_name_zh
, P1B.birthday p1b_birthday
, P1B.sexe p1b_gender
, P1B.nat p1b_nat
, P1B.photo p1b_photo
, P1B.taille p1b_height
, P1B.poids p1b_weight
, R1B.rank p1b_rank
, R1B.liveRank p1b_rank_live
, P1B.pro_depuis p1b_turn_pro
, P2.id p2_id
, P2.nom p2_name
, P2.prenom p2_first_name
, P2.name_zh p2_name_zh
, P2.birthday p2_birthday
, P2.sexe p2_gender
, P2.nat p2_nat
, P2.photo p2_photo
, P2.taille p2_height
, P2.poids p2_weight
, R2.rank p2_rank
, R2.liveRank p2_rank_live
, P2.pro_depuis p2_turn_pro
, '?' p2_best_rank
, P2.prise p2_forehand
, P2.revers p2_backhand
, M.ts2 p2_seed
, P2B.id p2b_id
, P2B.nom p2b_name
, P2B.prenom p2b_first_name
, P2B.name_zh p2b_name_zh
, P2B.birthday p2b_birthday
, P2B.sexe p2b_gender
, P2B.nat p2b_nat
, P2B.photo p2b_photo
, P2B.taille p2b_height
, P2B.poids p2b_weight
, R2B.rank p2b_rank
, R2B.liveRank p2b_rank_live
, P2B.pro_depuis p2b_turn_pro
, T.id tournament_id
, T.idt tournament_idt
, '?' rencontre_id
, N.name_fr tournament_name_fr
, N.name_en tournament_name_en
, N.name_zh tournament_name_zh
, N.name_de tournament_name_de
, N.name_es tournament_name_es
, T.ville tournament_city
, T.stade tournament_stadium
, T.surface tournament_surface
, T.surface_photo tournament_surface_photo
, T.surface_color tournament_surface_color
, T.monnaie tournament_currency
, T.prix tournament_prize_money
, SCO.nom_fr tournament_country
, T.logo tournament_logo
, T.debut tournament_start
, T.fin tournament_end
, T.nbj tournament_nbPlayer
, T.genre tournament_genre
, T.category tournament_category
, T.type tournament_type
, T.ids tournament_site
, T.year tournament_year
, T.importance tournament_importance
, '' team1
, '' team2
, T.importance
, T.background tournament_background
, SC.fuseau_horaire
, IF(ISNULL(LS.status) || M.status = 2 || M.status = 3 || M.status = 4, M.status, LS.status) match_status
, LS.serve
, S.time s_time_start
, S.court
, S.date_loc
, S.type s_type
, S.ordre s_order
, C.nom court_name
, C.ordre court_order
FROM
tournois_matchs M
INNER JOIN joueurs P1 on P1.id = M.j1
LEFT OUTER JOIN `joueurs` P1B on P1B.id = M.j1_bis
INNER JOIN joueurs P2 on P2.id = M.j2
LEFT OUTER JOIN `joueurs` P2B on P2B.id = M.j2_bis
LEFT JOIN tennis_rankings R1 on R1.player = P1.id AND R1.id = IF(P1.sexe = 1, 'wta', 'atp')
LEFT JOIN tennis_rankings R1B on R1B.player = P1B.id AND R1B.id = IF(P1B.sexe = 1, 'wta', 'atp')
LEFT JOIN tennis_rankings R2 on R2.player = P2.id AND R2.id = IF(P2.sexe = 1, 'wta', 'atp')
LEFT JOIN tennis_rankings R2B on R2B.player = P2B.id AND R2B.id = IF(P2B.sexe = 1, 'wta', 'atp')
INNER JOIN tournois T on T.id = M.idt
INNER JOIN tournois_name N on N.id = T.id && N.cup = 0
LEFT OUTER JOIN lieux_sites SL on T.ids = SL.id
LEFT OUTER JOIN lieux_villes SC on SL.idv = SC.id
LEFT OUTER JOIN lieux_pays SCO on SCO.code = SC.pays
LEFT OUTER JOIN `livescores_new`.`matchs` LS on LS.tt_match_id = M.id
LEFT OUTER JOIN tournois_programmes S on S.idm = M.id
LEFT OUTER JOIN lieux_courts C on C.ids = S.ids && C.ordre = S.court
WHERE
M.id = '9431618'
&& M.type_tournoi_add = 0
&& (S.statut = 0 || S.statut = 4 || S.statut = 2 || ISNULL(S.statut))
UNION
SELECT
M.*
, M.time_start time_start
, M.time time_end
, M.duration_pause
, M.type_match_add type_match
, M.type_tournoi_add type_tournament
, CR.niveau level
, M.qualif
, M.idw winner_id
, P1.id p1_id
, P1.nom p1_name
, P1.prenom p1_first_name
, P1.name_zh p1_name_zh
, P1.birthday p1_birthday
, P1.sexe p1_gender
, P1.nat p1_nat
, P1.photo p1_photo
, P1.taille p1_height
, P1.poids p1_weight
, R1.rank p1_rank
, R1.liveRank p1_rank_live
, P1.pro_depuis p1_turn_pro
, '?' p1_best_rank
, P1.prise p1_forehand
, P1.revers p1_backhand
, M.ts1 p1_seed
, P1B.id p1b_id
, P1B.nom p1b_name
, P1B.prenom p1b_first_name
, P1B.name_zh p1b_name_zh
, P1B.birthday p1b_birthday
, P1B.sexe p1b_gender
, P1B.nat p1b_nat
, P1B.photo p1b_photo
, P1B.taille p1b_height
, P1B.poids p1b_weight
, R1B.rank p1b_rank
, R1B.liveRank p1b_rank_live
, P1B.pro_depuis p1b_turn_pro
, P2.id p2_id
, P2.nom p2_name
, P2.prenom p2_first_name
, P2.name_zh p2_name_zh
, P2.birthday p2_birthday
, P2.sexe p2_gender
, P2.nat p2_nat
, P2.photo p2_photo
, P2.taille p2_height
, P2.poids p2_weight
, R2.rank p2_rank
, R2.liveRank p2_rank_live
, P2.pro_depuis p2_turn_pro
, '?' p2_best_rank
, P2.prise p2_forehand
, P2.revers p2_backhand
, M.ts2 p2_seed
, P2B.id p2b_id
, P2B.nom p2b_name
, P2B.prenom p2b_first_name
, P2B.name_zh p2b_name_zh
, P2B.birthday p2b_birthday
, P2B.sexe p2b_gender
, P2B.nat p2b_nat
, P2B.photo p2b_photo
, P2B.taille p2b_height
, P2B.poids p2b_weight
, R2B.rank p2b_rank
, R2B.liveRank p2b_rank_live
, P2B.pro_depuis p2b_turn_pro
, C.id tournament_id
, C.parent tournament_idt
, CR.id rencontre_id
, N.name_fr tournament_name_fr
, N.name_en tournament_name_en
, N.name_zh tournament_name_zh
, N.name_de tournament_name_de
, N.name_es tournament_name_es
, CONCAT(CR.equipe_domicile, '|', CR.equipe_exterieur) tournament_city
, '' tournament_stadium
, CR.surface tournament_surface
, '' tournament_surface_photo
, '0' tournament_surface_color
, '' tournament_currency
, '' tournament_prize_money
, SCO.nom_fr tournament_country
, '' tournament_logo
, CR.date_d tournament_start
, '' tournament_end
, C.nbj tournament_nbPlayer
, '' tournament_genre
, '' tournament_category
, '' tournament_type
, CR.lieu tournament_site
, '' tournament_year
, 65 tournament_importance
, IF(T1.nom_fr, T1.nom_fr, CR.equipe_domicile) team1
, IF(T2.nom_fr, T1.nom_fr, CR.equipe_exterieur) team2
, 65 importance
, '' tournament_background
, SC.fuseau_horaire
, IF(ISNULL(LS.status) || M.status = 2 || M.status = 3 || M.status = 4, M.status, LS.status) match_status
, LS.serve
, S.time s_time_start
, S.court
, S.date_loc
, S.type s_type
, S.ordre s_order
, CT.nom court_name
, CT.ordre court_order
FROM
tournois_matchs M
INNER JOIN joueurs P1 on P1.id = M.j1
LEFT OUTER JOIN `joueurs` P1B on P1B.id = M.j1_bis
INNER JOIN joueurs P2 on P2.id = M.j2
LEFT OUTER JOIN `joueurs` P2B on P2B.id = M.j2_bis
LEFT JOIN tennis_rankings R1 on R1.player = P1.id AND R1.id = IF(P1.sexe = 1, 'wta', 'atp')
LEFT JOIN tennis_rankings R1B on R1B.player = P1B.id AND R1B.id = IF(P1B.sexe = 1, 'wta', 'atp')
LEFT JOIN tennis_rankings R2 on R2.player = P2.id AND R2.id = IF(P2.sexe = 1, 'wta', 'atp')
LEFT JOIN tennis_rankings R2B on R2B.player = P2B.id AND R2B.id = IF(P2B.sexe = 1, 'wta', 'atp')
LEFT OUTER JOIN `livescores_new`.`matchs` LS ON (LS.tt_match_id = M.id)
LEFT OUTER JOIN tournois_programmes S on S.idm = M.id
LEFT OUTER JOIN lieux_courts CT on (CT.ids = S.ids && CT.ordre = S.court)
INNER JOIN `coupes_rencontres` CR on CR.id = M.idt
INNER JOIN `coupes` C on C.id = CR.coupe_id
INNER JOIN tournois_name N on N.id = C.id
LEFT JOIN lieux_sites SL on SL.id = CR.lieu
LEFT JOIN lieux_villes SC on SC.id = SL.idv
LEFT JOIN lieux_pays SCO on SCO.code = SC.pays
LEFT JOIN `lieux_pays` T1 ON (T1.code = CR.equipe_domicile)
LEFT JOIN `lieux_pays` T2 ON (T2.code = CR.equipe_exterieur)
WHERE
M.id = '9431618'
&& M.type_tournoi_add = 1
&& (S.statut = 0 || S.statut = 4 || S.statut = 2 || ISNULL(S.statut))
UNION
SELECT
M.*
, M.time_start time_start
, M.time time_end
, M.duration_pause
, M.type_match_add type_match
, M.type_tournoi_add type_tournament
, '' level
, M.qualif
, M.idw winner_id
, P1.id p1_id
, P1.nom p1_name
, P1.prenom p1_first_name
, P1.name_zh p1_name_zh
, P1.birthday p1_birthday
, P1.sexe p1_gender
, P1.nat p1_nat
, P1.photo p1_photo
, P1.taille p1_height
, P1.poids p1_weight
, R1.rank p1_rank
, R1.liveRank p1_rank_live
, P1.pro_depuis p1_turn_pro
, '?' p1_best_rank
, P1.prise p1_forehand
, P1.revers p1_backhand
, M.ts1 p1_seed
, P1B.id p1b_id
, P1B.nom p1b_name
, P1B.prenom p1b_first_name
, P1B.name_zh p1b_name_zh
, P1B.birthday p1b_birthday
, P1B.sexe p1b_gender
, P1B.nat p1b_nat
, P1B.photo p1b_photo
, P1B.taille p1b_height
, P1B.poids p1b_weight
, R1B.rank p1b_rank
, R1B.liveRank p1b_rank_live
, P1B.pro_depuis p1b_turn_pro
, P2.id p2_id
, P2.nom p2_name
, P2.prenom p2_first_name
, P2.name_zh p2_name_zh
, P2.birthday p2_birthday
, P2.sexe p2_gender
, P2.nat p2_nat
, P2.photo p2_photo
, P2.taille p2_height
, P2.poids p2_weight
, R2.rank p2_rank
, R2.liveRank p2_rank_live
, P2.pro_depuis p2_turn_pro
, '?' p2_best_rank
, P2.prise p2_forehand
, P2.revers p2_backhand
, M.ts2 p2_seed
, P2B.id p2b_id
, P2B.nom p2b_name
, P2B.prenom p2b_first_name
, P2B.name_zh p2b_name_zh
, P2B.birthday p2b_birthday
, P2B.sexe p2b_gender
, P2B.nat p2b_nat
, P2B.photo p2b_photo
, P2B.taille p2b_height
, P2B.poids p2b_weight
, R2B.rank p2b_rank
, R2B.liveRank p2b_rank_live
, P2B.pro_depuis p2b_turn_pro
, L.id tournament_id
, 0 tournament_idt
, LR.id rencontre_id
, N.name_fr tournament_name_fr
, N.name_en tournament_name_en
, N.name_zh tournament_name_zh
, N.name_de tournament_name_de
, N.name_es tournament_name_es
, SC.nom tournament_city
, '' tournament_stadium
, '3' tournament_surface
, '' tournament_surface_photo
, '0' tournament_surface_color
, '' tournament_currency
, '' tournament_prize_money
, SCO.nom_fr tournament_country
, '' tournament_logo
, L.time_start tournament_start
, '' tournament_end
, '' tournament_nbPlayer
, '' tournament_genre
, '' tournament_category
, '' tournament_type
, LR.site tournament_site
, L.year tournament_year
, 0 tournament_importance
, '' team1
, '' team2
, 3 importance
, '' tournament_background
, SC.fuseau_horaire
, IF(ISNULL(LS.status) || M.status = 2 || M.status = 3 || M.status = 4, M.status, LS.status) match_status
, LS.serve
, S.time s_time_start
, S.court
, S.date_loc
, S.type s_type
, S.ordre s_order
, CT.nom court_name
, CT.ordre court_order
FROM
tournois_matchs M
JOIN joueurs P1 on P1.id = M.j1
LEFT JOIN `joueurs` P1B on P1B.id = M.j1_bis
JOIN joueurs P2 on P2.id = M.j2
LEFT JOIN `joueurs` P2B on P2B.id = M.j2_bis
LEFT JOIN tennis_rankings R1 on R1.player = P1.id AND R1.id = IF(P1.sexe = 1, 'wta', 'atp')
LEFT JOIN tennis_rankings R1B on R1B.player = P1B.id AND R1B.id = IF(P1B.sexe = 1, 'wta', 'atp')
LEFT JOIN tennis_rankings R2 on R2.player = P2.id AND R2.id = IF(P2.sexe = 1, 'wta', 'atp')
LEFT JOIN tennis_rankings R2B on R2B.player = P2B.id AND R2B.id = IF(P2B.sexe = 1, 'wta', 'atp')
LEFT JOIN `livescores_new`.`matchs` LS ON (LS.tt_match_id = M.id)
LEFT JOIN tournois_programmes S on S.idm = M.id
LEFT JOIN lieux_courts CT on (CT.ids = S.ids && CT.ordre = S.court)
JOIN `leagues_rounds` LR on LR.id = M.league_round
JOIN `leagues` L on L.id = LR.league
JOIN tournois_name N on N.league = L.id
LEFT JOIN lieux_sites SL on SL.id = LR.site
LEFT JOIN lieux_villes SC on SC.id = SL.idv
LEFT JOIN lieux_pays SCO on SCO.code = SC.pays
WHERE
M.id = '9431618'
&& M.type_tournoi_add = 2
&& (S.statut = 0 || S.statut = 4 || S.statut = 2 || ISNULL(S.statut))
LIMIT 1
SELECT M.*
, M.time_start time_start
, M.time time_end
, M.duration_pause
, M.type_match_add type_match
, M.type_tournoi_add type_tournament
, M.niveau level
, M.qualif
, M.idw winner_id
, P1.id p1_id
, P1.nom p1_name
, P1.prenom p1_first_name
, P1.name_zh p1_name_zh
, P1.birthday p1_birthday
, P1.sexe p1_gender
, P1.nat p1_nat
, P1.photo p1_photo
, P1.taille p1_height
, P1.poids p1_weight
, R1.rank p1_rank
, R1.liveRank p1_rank_live
, P1.pro_depuis p1_turn_pro
, '?' p1_best_rank
, P1.prise p1_forehand
, P1.revers p1_backhand
, M.ts1 p1_seed
, P1B.id p1b_id
, P1B.nom p1b_name
, P1B.prenom p1b_first_name
, P1B.name_zh p1b_name_zh
, P1B.birthday p1b_birthday
, P1B.sexe p1b_gender
, P1B.nat p1b_nat
, P1B.photo p1b_photo
, P1B.taille p1b_height
, P1B.poids p1b_weight
, R1B.rank p1b_rank
, R1B.liveRank p1b_rank_live
, P1B.pro_depuis p1b_turn_pro
, P2.id p2_id
, P2.nom p2_name
, P2.prenom p2_first_name
, P2.name_zh p2_name_zh
, P2.birthday p2_birthday
, P2.sexe p2_gender
, P2.nat p2_nat
, P2.photo p2_photo
, P2.taille p2_height
, P2.poids p2_weight
, R2.rank p2_rank
, R2.liveRank p2_rank_live
, P2.pro_depuis p2_turn_pro
, '?' p2_best_rank
, P2.prise p2_forehand
, P2.revers p2_backhand
, M.ts2 p2_seed
, P2B.id p2b_id
, P2B.nom p2b_name
, P2B.prenom p2b_first_name
, P2B.name_zh p2b_name_zh
, P2B.birthday p2b_birthday
, P2B.sexe p2b_gender
, P2B.nat p2b_nat
, P2B.photo p2b_photo
, P2B.taille p2b_height
, P2B.poids p2b_weight
, R2B.rank p2b_rank
, R2B.liveRank p2b_rank_live
, P2B.pro_depuis p2b_turn_pro
, T.id tournament_id
, T.idt tournament_idt
, '?' rencontre_id
, N.name_fr tournament_name_fr
, N.name_en tournament_name_en
, N.name_zh tournament_name_zh
, N.name_de tournament_name_de
, N.name_es tournament_name_es
, T.ville tournament_city
, T.stade tournament_stadium
, T.surface tournament_surface
, T.surface_photo tournament_surface_photo
, T.surface_color tournament_surface_color
, T.monnaie tournament_currency
, T.prix tournament_prize_money
, SCO.nom_fr tournament_country
, T.logo tournament_logo
, T.debut tournament_start
, T.fin tournament_end
, T.nbj tournament_nbPlayer
, T.genre tournament_genre
, T.category tournament_category
, T.type tournament_type
, T.ids tournament_site
, T.year tournament_year
, T.importance tournament_importance
, '' team1
, '' team2
, T.importance
, T.background tournament_background
, SC.fuseau_horaire
, IF(ISNULL(LS.status) || M.status = 2 || M.status = 3 || M.status = 4, M.status, LS.status) match_status
, LS.serve
, S.time s_time_start
, S.court
, S.date_loc
, S.type s_type
, S.ordre s_order
, C.nom court_name
, C.ordre court_order
FROM
tournois_matchs M
INNER JOIN joueurs P1 on P1.id = M.j1
LEFT OUTER JOIN `joueurs` P1B on P1B.id = M.j1_bis
INNER JOIN joueurs P2 on P2.id = M.j2
LEFT OUTER JOIN `joueurs` P2B on P2B.id = M.j2_bis
LEFT JOIN tennis_rankings R1 on R1.player = P1.id AND R1.id = IF(P1.sexe = 1, 'wta', 'atp')
LEFT JOIN tennis_rankings R1B on R1B.player = P1B.id AND R1B.id = IF(P1B.sexe = 1, 'wta', 'atp')
LEFT JOIN tennis_rankings R2 on R2.player = P2.id AND R2.id = IF(P2.sexe = 1, 'wta', 'atp')
LEFT JOIN tennis_rankings R2B on R2B.player = P2B.id AND R2B.id = IF(P2B.sexe = 1, 'wta', 'atp')
INNER JOIN tournois T on T.id = M.idt
INNER JOIN tournois_name N on N.id = T.id && N.cup = 0
LEFT OUTER JOIN lieux_sites SL on T.ids = SL.id
LEFT OUTER JOIN lieux_villes SC on SL.idv = SC.id
LEFT OUTER JOIN lieux_pays SCO on SCO.code = SC.pays
LEFT OUTER JOIN `livescores_new`.`matchs` LS on LS.tt_match_id = M.id
LEFT OUTER JOIN tournois_programmes S on S.idm = M.id
LEFT OUTER JOIN lieux_courts C on C.ids = S.ids && C.ordre = S.court
WHERE
M.id = '9431624'
&& M.type_tournoi_add = 0
&& (S.statut = 0 || S.statut = 4 || S.statut = 2 || ISNULL(S.statut))
UNION
SELECT
M.*
, M.time_start time_start
, M.time time_end
, M.duration_pause
, M.type_match_add type_match
, M.type_tournoi_add type_tournament
, CR.niveau level
, M.qualif
, M.idw winner_id
, P1.id p1_id
, P1.nom p1_name
, P1.prenom p1_first_name
, P1.name_zh p1_name_zh
, P1.birthday p1_birthday
, P1.sexe p1_gender
, P1.nat p1_nat
, P1.photo p1_photo
, P1.taille p1_height
, P1.poids p1_weight
, R1.rank p1_rank
, R1.liveRank p1_rank_live
, P1.pro_depuis p1_turn_pro
, '?' p1_best_rank
, P1.prise p1_forehand
, P1.revers p1_backhand
, M.ts1 p1_seed
, P1B.id p1b_id
, P1B.nom p1b_name
, P1B.prenom p1b_first_name
, P1B.name_zh p1b_name_zh
, P1B.birthday p1b_birthday
, P1B.sexe p1b_gender
, P1B.nat p1b_nat
, P1B.photo p1b_photo
, P1B.taille p1b_height
, P1B.poids p1b_weight
, R1B.rank p1b_rank
, R1B.liveRank p1b_rank_live
, P1B.pro_depuis p1b_turn_pro
, P2.id p2_id
, P2.nom p2_name
, P2.prenom p2_first_name
, P2.name_zh p2_name_zh
, P2.birthday p2_birthday
, P2.sexe p2_gender
, P2.nat p2_nat
, P2.photo p2_photo
, P2.taille p2_height
, P2.poids p2_weight
, R2.rank p2_rank
, R2.liveRank p2_rank_live
, P2.pro_depuis p2_turn_pro
, '?' p2_best_rank
, P2.prise p2_forehand
, P2.revers p2_backhand
, M.ts2 p2_seed
, P2B.id p2b_id
, P2B.nom p2b_name
, P2B.prenom p2b_first_name
, P2B.name_zh p2b_name_zh
, P2B.birthday p2b_birthday
, P2B.sexe p2b_gender
, P2B.nat p2b_nat
, P2B.photo p2b_photo
, P2B.taille p2b_height
, P2B.poids p2b_weight
, R2B.rank p2b_rank
, R2B.liveRank p2b_rank_live
, P2B.pro_depuis p2b_turn_pro
, C.id tournament_id
, C.parent tournament_idt
, CR.id rencontre_id
, N.name_fr tournament_name_fr
, N.name_en tournament_name_en
, N.name_zh tournament_name_zh
, N.name_de tournament_name_de
, N.name_es tournament_name_es
, CONCAT(CR.equipe_domicile, '|', CR.equipe_exterieur) tournament_city
, '' tournament_stadium
, CR.surface tournament_surface
, '' tournament_surface_photo
, '0' tournament_surface_color
, '' tournament_currency
, '' tournament_prize_money
, SCO.nom_fr tournament_country
, '' tournament_logo
, CR.date_d tournament_start
, '' tournament_end
, C.nbj tournament_nbPlayer
, '' tournament_genre
, '' tournament_category
, '' tournament_type
, CR.lieu tournament_site
, '' tournament_year
, 65 tournament_importance
, IF(T1.nom_fr, T1.nom_fr, CR.equipe_domicile) team1
, IF(T2.nom_fr, T1.nom_fr, CR.equipe_exterieur) team2
, 65 importance
, '' tournament_background
, SC.fuseau_horaire
, IF(ISNULL(LS.status) || M.status = 2 || M.status = 3 || M.status = 4, M.status, LS.status) match_status
, LS.serve
, S.time s_time_start
, S.court
, S.date_loc
, S.type s_type
, S.ordre s_order
, CT.nom court_name
, CT.ordre court_order
FROM
tournois_matchs M
INNER JOIN joueurs P1 on P1.id = M.j1
LEFT OUTER JOIN `joueurs` P1B on P1B.id = M.j1_bis
INNER JOIN joueurs P2 on P2.id = M.j2
LEFT OUTER JOIN `joueurs` P2B on P2B.id = M.j2_bis
LEFT JOIN tennis_rankings R1 on R1.player = P1.id AND R1.id = IF(P1.sexe = 1, 'wta', 'atp')
LEFT JOIN tennis_rankings R1B on R1B.player = P1B.id AND R1B.id = IF(P1B.sexe = 1, 'wta', 'atp')
LEFT JOIN tennis_rankings R2 on R2.player = P2.id AND R2.id = IF(P2.sexe = 1, 'wta', 'atp')
LEFT JOIN tennis_rankings R2B on R2B.player = P2B.id AND R2B.id = IF(P2B.sexe = 1, 'wta', 'atp')
LEFT OUTER JOIN `livescores_new`.`matchs` LS ON (LS.tt_match_id = M.id)
LEFT OUTER JOIN tournois_programmes S on S.idm = M.id
LEFT OUTER JOIN lieux_courts CT on (CT.ids = S.ids && CT.ordre = S.court)
INNER JOIN `coupes_rencontres` CR on CR.id = M.idt
INNER JOIN `coupes` C on C.id = CR.coupe_id
INNER JOIN tournois_name N on N.id = C.id
LEFT JOIN lieux_sites SL on SL.id = CR.lieu
LEFT JOIN lieux_villes SC on SC.id = SL.idv
LEFT JOIN lieux_pays SCO on SCO.code = SC.pays
LEFT JOIN `lieux_pays` T1 ON (T1.code = CR.equipe_domicile)
LEFT JOIN `lieux_pays` T2 ON (T2.code = CR.equipe_exterieur)
WHERE
M.id = '9431624'
&& M.type_tournoi_add = 1
&& (S.statut = 0 || S.statut = 4 || S.statut = 2 || ISNULL(S.statut))
UNION
SELECT
M.*
, M.time_start time_start
, M.time time_end
, M.duration_pause
, M.type_match_add type_match
, M.type_tournoi_add type_tournament
, '' level
, M.qualif
, M.idw winner_id
, P1.id p1_id
, P1.nom p1_name
, P1.prenom p1_first_name
, P1.name_zh p1_name_zh
, P1.birthday p1_birthday
, P1.sexe p1_gender
, P1.nat p1_nat
, P1.photo p1_photo
, P1.taille p1_height
, P1.poids p1_weight
, R1.rank p1_rank
, R1.liveRank p1_rank_live
, P1.pro_depuis p1_turn_pro
, '?' p1_best_rank
, P1.prise p1_forehand
, P1.revers p1_backhand
, M.ts1 p1_seed
, P1B.id p1b_id
, P1B.nom p1b_name
, P1B.prenom p1b_first_name
, P1B.name_zh p1b_name_zh
, P1B.birthday p1b_birthday
, P1B.sexe p1b_gender
, P1B.nat p1b_nat
, P1B.photo p1b_photo
, P1B.taille p1b_height
, P1B.poids p1b_weight
, R1B.rank p1b_rank
, R1B.liveRank p1b_rank_live
, P1B.pro_depuis p1b_turn_pro
, P2.id p2_id
, P2.nom p2_name
, P2.prenom p2_first_name
, P2.name_zh p2_name_zh
, P2.birthday p2_birthday
, P2.sexe p2_gender
, P2.nat p2_nat
, P2.photo p2_photo
, P2.taille p2_height
, P2.poids p2_weight
, R2.rank p2_rank
, R2.liveRank p2_rank_live
, P2.pro_depuis p2_turn_pro
, '?' p2_best_rank
, P2.prise p2_forehand
, P2.revers p2_backhand
, M.ts2 p2_seed
, P2B.id p2b_id
, P2B.nom p2b_name
, P2B.prenom p2b_first_name
, P2B.name_zh p2b_name_zh
, P2B.birthday p2b_birthday
, P2B.sexe p2b_gender
, P2B.nat p2b_nat
, P2B.photo p2b_photo
, P2B.taille p2b_height
, P2B.poids p2b_weight
, R2B.rank p2b_rank
, R2B.liveRank p2b_rank_live
, P2B.pro_depuis p2b_turn_pro
, L.id tournament_id
, 0 tournament_idt
, LR.id rencontre_id
, N.name_fr tournament_name_fr
, N.name_en tournament_name_en
, N.name_zh tournament_name_zh
, N.name_de tournament_name_de
, N.name_es tournament_name_es
, SC.nom tournament_city
, '' tournament_stadium
, '3' tournament_surface
, '' tournament_surface_photo
, '0' tournament_surface_color
, '' tournament_currency
, '' tournament_prize_money
, SCO.nom_fr tournament_country
, '' tournament_logo
, L.time_start tournament_start
, '' tournament_end
, '' tournament_nbPlayer
, '' tournament_genre
, '' tournament_category
, '' tournament_type
, LR.site tournament_site
, L.year tournament_year
, 0 tournament_importance
, '' team1
, '' team2
, 3 importance
, '' tournament_background
, SC.fuseau_horaire
, IF(ISNULL(LS.status) || M.status = 2 || M.status = 3 || M.status = 4, M.status, LS.status) match_status
, LS.serve
, S.time s_time_start
, S.court
, S.date_loc
, S.type s_type
, S.ordre s_order
, CT.nom court_name
, CT.ordre court_order
FROM
tournois_matchs M
JOIN joueurs P1 on P1.id = M.j1
LEFT JOIN `joueurs` P1B on P1B.id = M.j1_bis
JOIN joueurs P2 on P2.id = M.j2
LEFT JOIN `joueurs` P2B on P2B.id = M.j2_bis
LEFT JOIN tennis_rankings R1 on R1.player = P1.id AND R1.id = IF(P1.sexe = 1, 'wta', 'atp')
LEFT JOIN tennis_rankings R1B on R1B.player = P1B.id AND R1B.id = IF(P1B.sexe = 1, 'wta', 'atp')
LEFT JOIN tennis_rankings R2 on R2.player = P2.id AND R2.id = IF(P2.sexe = 1, 'wta', 'atp')
LEFT JOIN tennis_rankings R2B on R2B.player = P2B.id AND R2B.id = IF(P2B.sexe = 1, 'wta', 'atp')
LEFT JOIN `livescores_new`.`matchs` LS ON (LS.tt_match_id = M.id)
LEFT JOIN tournois_programmes S on S.idm = M.id
LEFT JOIN lieux_courts CT on (CT.ids = S.ids && CT.ordre = S.court)
JOIN `leagues_rounds` LR on LR.id = M.league_round
JOIN `leagues` L on L.id = LR.league
JOIN tournois_name N on N.league = L.id
LEFT JOIN lieux_sites SL on SL.id = LR.site
LEFT JOIN lieux_villes SC on SC.id = SL.idv
LEFT JOIN lieux_pays SCO on SCO.code = SC.pays
WHERE
M.id = '9431624'
&& M.type_tournoi_add = 2
&& (S.statut = 0 || S.statut = 4 || S.statut = 2 || ISNULL(S.statut))
LIMIT 1
SELECT M.*
, M.time_start time_start
, M.time time_end
, M.duration_pause
, M.type_match_add type_match
, M.type_tournoi_add type_tournament
, M.niveau level
, M.qualif
, M.idw winner_id
, P1.id p1_id
, P1.nom p1_name
, P1.prenom p1_first_name
, P1.name_zh p1_name_zh
, P1.birthday p1_birthday
, P1.sexe p1_gender
, P1.nat p1_nat
, P1.photo p1_photo
, P1.taille p1_height
, P1.poids p1_weight
, R1.rank p1_rank
, R1.liveRank p1_rank_live
, P1.pro_depuis p1_turn_pro
, '?' p1_best_rank
, P1.prise p1_forehand
, P1.revers p1_backhand
, M.ts1 p1_seed
, P1B.id p1b_id
, P1B.nom p1b_name
, P1B.prenom p1b_first_name
, P1B.name_zh p1b_name_zh
, P1B.birthday p1b_birthday
, P1B.sexe p1b_gender
, P1B.nat p1b_nat
, P1B.photo p1b_photo
, P1B.taille p1b_height
, P1B.poids p1b_weight
, R1B.rank p1b_rank
, R1B.liveRank p1b_rank_live
, P1B.pro_depuis p1b_turn_pro
, P2.id p2_id
, P2.nom p2_name
, P2.prenom p2_first_name
, P2.name_zh p2_name_zh
, P2.birthday p2_birthday
, P2.sexe p2_gender
, P2.nat p2_nat
, P2.photo p2_photo
, P2.taille p2_height
, P2.poids p2_weight
, R2.rank p2_rank
, R2.liveRank p2_rank_live
, P2.pro_depuis p2_turn_pro
, '?' p2_best_rank
, P2.prise p2_forehand
, P2.revers p2_backhand
, M.ts2 p2_seed
, P2B.id p2b_id
, P2B.nom p2b_name
, P2B.prenom p2b_first_name
, P2B.name_zh p2b_name_zh
, P2B.birthday p2b_birthday
, P2B.sexe p2b_gender
, P2B.nat p2b_nat
, P2B.photo p2b_photo
, P2B.taille p2b_height
, P2B.poids p2b_weight
, R2B.rank p2b_rank
, R2B.liveRank p2b_rank_live
, P2B.pro_depuis p2b_turn_pro
, T.id tournament_id
, T.idt tournament_idt
, '?' rencontre_id
, N.name_fr tournament_name_fr
, N.name_en tournament_name_en
, N.name_zh tournament_name_zh
, N.name_de tournament_name_de
, N.name_es tournament_name_es
, T.ville tournament_city
, T.stade tournament_stadium
, T.surface tournament_surface
, T.surface_photo tournament_surface_photo
, T.surface_color tournament_surface_color
, T.monnaie tournament_currency
, T.prix tournament_prize_money
, SCO.nom_fr tournament_country
, T.logo tournament_logo
, T.debut tournament_start
, T.fin tournament_end
, T.nbj tournament_nbPlayer
, T.genre tournament_genre
, T.category tournament_category
, T.type tournament_type
, T.ids tournament_site
, T.year tournament_year
, T.importance tournament_importance
, '' team1
, '' team2
, T.importance
, T.background tournament_background
, SC.fuseau_horaire
, IF(ISNULL(LS.status) || M.status = 2 || M.status = 3 || M.status = 4, M.status, LS.status) match_status
, LS.serve
, S.time s_time_start
, S.court
, S.date_loc
, S.type s_type
, S.ordre s_order
, C.nom court_name
, C.ordre court_order
FROM
tournois_matchs M
INNER JOIN joueurs P1 on P1.id = M.j1
LEFT OUTER JOIN `joueurs` P1B on P1B.id = M.j1_bis
INNER JOIN joueurs P2 on P2.id = M.j2
LEFT OUTER JOIN `joueurs` P2B on P2B.id = M.j2_bis
LEFT JOIN tennis_rankings R1 on R1.player = P1.id AND R1.id = IF(P1.sexe = 1, 'wta', 'atp')
LEFT JOIN tennis_rankings R1B on R1B.player = P1B.id AND R1B.id = IF(P1B.sexe = 1, 'wta', 'atp')
LEFT JOIN tennis_rankings R2 on R2.player = P2.id AND R2.id = IF(P2.sexe = 1, 'wta', 'atp')
LEFT JOIN tennis_rankings R2B on R2B.player = P2B.id AND R2B.id = IF(P2B.sexe = 1, 'wta', 'atp')
INNER JOIN tournois T on T.id = M.idt
INNER JOIN tournois_name N on N.id = T.id && N.cup = 0
LEFT OUTER JOIN lieux_sites SL on T.ids = SL.id
LEFT OUTER JOIN lieux_villes SC on SL.idv = SC.id
LEFT OUTER JOIN lieux_pays SCO on SCO.code = SC.pays
LEFT OUTER JOIN `livescores_new`.`matchs` LS on LS.tt_match_id = M.id
LEFT OUTER JOIN tournois_programmes S on S.idm = M.id
LEFT OUTER JOIN lieux_courts C on C.ids = S.ids && C.ordre = S.court
WHERE
M.id = '9431630'
&& M.type_tournoi_add = 0
&& (S.statut = 0 || S.statut = 4 || S.statut = 2 || ISNULL(S.statut))
UNION
SELECT
M.*
, M.time_start time_start
, M.time time_end
, M.duration_pause
, M.type_match_add type_match
, M.type_tournoi_add type_tournament
, CR.niveau level
, M.qualif
, M.idw winner_id
, P1.id p1_id
, P1.nom p1_name
, P1.prenom p1_first_name
, P1.name_zh p1_name_zh
, P1.birthday p1_birthday
, P1.sexe p1_gender
, P1.nat p1_nat
, P1.photo p1_photo
, P1.taille p1_height
, P1.poids p1_weight
, R1.rank p1_rank
, R1.liveRank p1_rank_live
, P1.pro_depuis p1_turn_pro
, '?' p1_best_rank
, P1.prise p1_forehand
, P1.revers p1_backhand
, M.ts1 p1_seed
, P1B.id p1b_id
, P1B.nom p1b_name
, P1B.prenom p1b_first_name
, P1B.name_zh p1b_name_zh
, P1B.birthday p1b_birthday
, P1B.sexe p1b_gender
, P1B.nat p1b_nat
, P1B.photo p1b_photo
, P1B.taille p1b_height
, P1B.poids p1b_weight
, R1B.rank p1b_rank
, R1B.liveRank p1b_rank_live
, P1B.pro_depuis p1b_turn_pro
, P2.id p2_id
, P2.nom p2_name
, P2.prenom p2_first_name
, P2.name_zh p2_name_zh
, P2.birthday p2_birthday
, P2.sexe p2_gender
, P2.nat p2_nat
, P2.photo p2_photo
, P2.taille p2_height
, P2.poids p2_weight
, R2.rank p2_rank
, R2.liveRank p2_rank_live
, P2.pro_depuis p2_turn_pro
, '?' p2_best_rank
, P2.prise p2_forehand
, P2.revers p2_backhand
, M.ts2 p2_seed
, P2B.id p2b_id
, P2B.nom p2b_name
, P2B.prenom p2b_first_name
, P2B.name_zh p2b_name_zh
, P2B.birthday p2b_birthday
, P2B.sexe p2b_gender
, P2B.nat p2b_nat
, P2B.photo p2b_photo
, P2B.taille p2b_height
, P2B.poids p2b_weight
, R2B.rank p2b_rank
, R2B.liveRank p2b_rank_live
, P2B.pro_depuis p2b_turn_pro
, C.id tournament_id
, C.parent tournament_idt
, CR.id rencontre_id
, N.name_fr tournament_name_fr
, N.name_en tournament_name_en
, N.name_zh tournament_name_zh
, N.name_de tournament_name_de
, N.name_es tournament_name_es
, CONCAT(CR.equipe_domicile, '|', CR.equipe_exterieur) tournament_city
, '' tournament_stadium
, CR.surface tournament_surface
, '' tournament_surface_photo
, '0' tournament_surface_color
, '' tournament_currency
, '' tournament_prize_money
, SCO.nom_fr tournament_country
, '' tournament_logo
, CR.date_d tournament_start
, '' tournament_end
, C.nbj tournament_nbPlayer
, '' tournament_genre
, '' tournament_category
, '' tournament_type
, CR.lieu tournament_site
, '' tournament_year
, 65 tournament_importance
, IF(T1.nom_fr, T1.nom_fr, CR.equipe_domicile) team1
, IF(T2.nom_fr, T1.nom_fr, CR.equipe_exterieur) team2
, 65 importance
, '' tournament_background
, SC.fuseau_horaire
, IF(ISNULL(LS.status) || M.status = 2 || M.status = 3 || M.status = 4, M.status, LS.status) match_status
, LS.serve
, S.time s_time_start
, S.court
, S.date_loc
, S.type s_type
, S.ordre s_order
, CT.nom court_name
, CT.ordre court_order
FROM
tournois_matchs M
INNER JOIN joueurs P1 on P1.id = M.j1
LEFT OUTER JOIN `joueurs` P1B on P1B.id = M.j1_bis
INNER JOIN joueurs P2 on P2.id = M.j2
LEFT OUTER JOIN `joueurs` P2B on P2B.id = M.j2_bis
LEFT JOIN tennis_rankings R1 on R1.player = P1.id AND R1.id = IF(P1.sexe = 1, 'wta', 'atp')
LEFT JOIN tennis_rankings R1B on R1B.player = P1B.id AND R1B.id = IF(P1B.sexe = 1, 'wta', 'atp')
LEFT JOIN tennis_rankings R2 on R2.player = P2.id AND R2.id = IF(P2.sexe = 1, 'wta', 'atp')
LEFT JOIN tennis_rankings R2B on R2B.player = P2B.id AND R2B.id = IF(P2B.sexe = 1, 'wta', 'atp')
LEFT OUTER JOIN `livescores_new`.`matchs` LS ON (LS.tt_match_id = M.id)
LEFT OUTER JOIN tournois_programmes S on S.idm = M.id
LEFT OUTER JOIN lieux_courts CT on (CT.ids = S.ids && CT.ordre = S.court)
INNER JOIN `coupes_rencontres` CR on CR.id = M.idt
INNER JOIN `coupes` C on C.id = CR.coupe_id
INNER JOIN tournois_name N on N.id = C.id
LEFT JOIN lieux_sites SL on SL.id = CR.lieu
LEFT JOIN lieux_villes SC on SC.id = SL.idv
LEFT JOIN lieux_pays SCO on SCO.code = SC.pays
LEFT JOIN `lieux_pays` T1 ON (T1.code = CR.equipe_domicile)
LEFT JOIN `lieux_pays` T2 ON (T2.code = CR.equipe_exterieur)
WHERE
M.id = '9431630'
&& M.type_tournoi_add = 1
&& (S.statut = 0 || S.statut = 4 || S.statut = 2 || ISNULL(S.statut))
UNION
SELECT
M.*
, M.time_start time_start
, M.time time_end
, M.duration_pause
, M.type_match_add type_match
, M.type_tournoi_add type_tournament
, '' level
, M.qualif
, M.idw winner_id
, P1.id p1_id
, P1.nom p1_name
, P1.prenom p1_first_name
, P1.name_zh p1_name_zh
, P1.birthday p1_birthday
, P1.sexe p1_gender
, P1.nat p1_nat
, P1.photo p1_photo
, P1.taille p1_height
, P1.poids p1_weight
, R1.rank p1_rank
, R1.liveRank p1_rank_live
, P1.pro_depuis p1_turn_pro
, '?' p1_best_rank
, P1.prise p1_forehand
, P1.revers p1_backhand
, M.ts1 p1_seed
, P1B.id p1b_id
, P1B.nom p1b_name
, P1B.prenom p1b_first_name
, P1B.name_zh p1b_name_zh
, P1B.birthday p1b_birthday
, P1B.sexe p1b_gender
, P1B.nat p1b_nat
, P1B.photo p1b_photo
, P1B.taille p1b_height
, P1B.poids p1b_weight
, R1B.rank p1b_rank
, R1B.liveRank p1b_rank_live
, P1B.pro_depuis p1b_turn_pro
, P2.id p2_id
, P2.nom p2_name
, P2.prenom p2_first_name
, P2.name_zh p2_name_zh
, P2.birthday p2_birthday
, P2.sexe p2_gender
, P2.nat p2_nat
, P2.photo p2_photo
, P2.taille p2_height
, P2.poids p2_weight
, R2.rank p2_rank
, R2.liveRank p2_rank_live
, P2.pro_depuis p2_turn_pro
, '?' p2_best_rank
, P2.prise p2_forehand
, P2.revers p2_backhand
, M.ts2 p2_seed
, P2B.id p2b_id
, P2B.nom p2b_name
, P2B.prenom p2b_first_name
, P2B.name_zh p2b_name_zh
, P2B.birthday p2b_birthday
, P2B.sexe p2b_gender
, P2B.nat p2b_nat
, P2B.photo p2b_photo
, P2B.taille p2b_height
, P2B.poids p2b_weight
, R2B.rank p2b_rank
, R2B.liveRank p2b_rank_live
, P2B.pro_depuis p2b_turn_pro
, L.id tournament_id
, 0 tournament_idt
, LR.id rencontre_id
, N.name_fr tournament_name_fr
, N.name_en tournament_name_en
, N.name_zh tournament_name_zh
, N.name_de tournament_name_de
, N.name_es tournament_name_es
, SC.nom tournament_city
, '' tournament_stadium
, '3' tournament_surface
, '' tournament_surface_photo
, '0' tournament_surface_color
, '' tournament_currency
, '' tournament_prize_money
, SCO.nom_fr tournament_country
, '' tournament_logo
, L.time_start tournament_start
, '' tournament_end
, '' tournament_nbPlayer
, '' tournament_genre
, '' tournament_category
, '' tournament_type
, LR.site tournament_site
, L.year tournament_year
, 0 tournament_importance
, '' team1
, '' team2
, 3 importance
, '' tournament_background
, SC.fuseau_horaire
, IF(ISNULL(LS.status) || M.status = 2 || M.status = 3 || M.status = 4, M.status, LS.status) match_status
, LS.serve
, S.time s_time_start
, S.court
, S.date_loc
, S.type s_type
, S.ordre s_order
, CT.nom court_name
, CT.ordre court_order
FROM
tournois_matchs M
JOIN joueurs P1 on P1.id = M.j1
LEFT JOIN `joueurs` P1B on P1B.id = M.j1_bis
JOIN joueurs P2 on P2.id = M.j2
LEFT JOIN `joueurs` P2B on P2B.id = M.j2_bis
LEFT JOIN tennis_rankings R1 on R1.player = P1.id AND R1.id = IF(P1.sexe = 1, 'wta', 'atp')
LEFT JOIN tennis_rankings R1B on R1B.player = P1B.id AND R1B.id = IF(P1B.sexe = 1, 'wta', 'atp')
LEFT JOIN tennis_rankings R2 on R2.player = P2.id AND R2.id = IF(P2.sexe = 1, 'wta', 'atp')
LEFT JOIN tennis_rankings R2B on R2B.player = P2B.id AND R2B.id = IF(P2B.sexe = 1, 'wta', 'atp')
LEFT JOIN `livescores_new`.`matchs` LS ON (LS.tt_match_id = M.id)
LEFT JOIN tournois_programmes S on S.idm = M.id
LEFT JOIN lieux_courts CT on (CT.ids = S.ids && CT.ordre = S.court)
JOIN `leagues_rounds` LR on LR.id = M.league_round
JOIN `leagues` L on L.id = LR.league
JOIN tournois_name N on N.league = L.id
LEFT JOIN lieux_sites SL on SL.id = LR.site
LEFT JOIN lieux_villes SC on SC.id = SL.idv
LEFT JOIN lieux_pays SCO on SCO.code = SC.pays
WHERE
M.id = '9431630'
&& M.type_tournoi_add = 2
&& (S.statut = 0 || S.statut = 4 || S.statut = 2 || ISNULL(S.statut))
LIMIT 1
SELECT M.*
, M.time_start time_start
, M.time time_end
, M.duration_pause
, M.type_match_add type_match
, M.type_tournoi_add type_tournament
, M.niveau level
, M.qualif
, M.idw winner_id
, P1.id p1_id
, P1.nom p1_name
, P1.prenom p1_first_name
, P1.name_zh p1_name_zh
, P1.birthday p1_birthday
, P1.sexe p1_gender
, P1.nat p1_nat
, P1.photo p1_photo
, P1.taille p1_height
, P1.poids p1_weight
, R1.rank p1_rank
, R1.liveRank p1_rank_live
, P1.pro_depuis p1_turn_pro
, '?' p1_best_rank
, P1.prise p1_forehand
, P1.revers p1_backhand
, M.ts1 p1_seed
, P1B.id p1b_id
, P1B.nom p1b_name
, P1B.prenom p1b_first_name
, P1B.name_zh p1b_name_zh
, P1B.birthday p1b_birthday
, P1B.sexe p1b_gender
, P1B.nat p1b_nat
, P1B.photo p1b_photo
, P1B.taille p1b_height
, P1B.poids p1b_weight
, R1B.rank p1b_rank
, R1B.liveRank p1b_rank_live
, P1B.pro_depuis p1b_turn_pro
, P2.id p2_id
, P2.nom p2_name
, P2.prenom p2_first_name
, P2.name_zh p2_name_zh
, P2.birthday p2_birthday
, P2.sexe p2_gender
, P2.nat p2_nat
, P2.photo p2_photo
, P2.taille p2_height
, P2.poids p2_weight
, R2.rank p2_rank
, R2.liveRank p2_rank_live
, P2.pro_depuis p2_turn_pro
, '?' p2_best_rank
, P2.prise p2_forehand
, P2.revers p2_backhand
, M.ts2 p2_seed
, P2B.id p2b_id
, P2B.nom p2b_name
, P2B.prenom p2b_first_name
, P2B.name_zh p2b_name_zh
, P2B.birthday p2b_birthday
, P2B.sexe p2b_gender
, P2B.nat p2b_nat
, P2B.photo p2b_photo
, P2B.taille p2b_height
, P2B.poids p2b_weight
, R2B.rank p2b_rank
, R2B.liveRank p2b_rank_live
, P2B.pro_depuis p2b_turn_pro
, T.id tournament_id
, T.idt tournament_idt
, '?' rencontre_id
, N.name_fr tournament_name_fr
, N.name_en tournament_name_en
, N.name_zh tournament_name_zh
, N.name_de tournament_name_de
, N.name_es tournament_name_es
, T.ville tournament_city
, T.stade tournament_stadium
, T.surface tournament_surface
, T.surface_photo tournament_surface_photo
, T.surface_color tournament_surface_color
, T.monnaie tournament_currency
, T.prix tournament_prize_money
, SCO.nom_fr tournament_country
, T.logo tournament_logo
, T.debut tournament_start
, T.fin tournament_end
, T.nbj tournament_nbPlayer
, T.genre tournament_genre
, T.category tournament_category
, T.type tournament_type
, T.ids tournament_site
, T.year tournament_year
, T.importance tournament_importance
, '' team1
, '' team2
, T.importance
, T.background tournament_background
, SC.fuseau_horaire
, IF(ISNULL(LS.status) || M.status = 2 || M.status = 3 || M.status = 4, M.status, LS.status) match_status
, LS.serve
, S.time s_time_start
, S.court
, S.date_loc
, S.type s_type
, S.ordre s_order
, C.nom court_name
, C.ordre court_order
FROM
tournois_matchs M
INNER JOIN joueurs P1 on P1.id = M.j1
LEFT OUTER JOIN `joueurs` P1B on P1B.id = M.j1_bis
INNER JOIN joueurs P2 on P2.id = M.j2
LEFT OUTER JOIN `joueurs` P2B on P2B.id = M.j2_bis
LEFT JOIN tennis_rankings R1 on R1.player = P1.id AND R1.id = IF(P1.sexe = 1, 'wta', 'atp')
LEFT JOIN tennis_rankings R1B on R1B.player = P1B.id AND R1B.id = IF(P1B.sexe = 1, 'wta', 'atp')
LEFT JOIN tennis_rankings R2 on R2.player = P2.id AND R2.id = IF(P2.sexe = 1, 'wta', 'atp')
LEFT JOIN tennis_rankings R2B on R2B.player = P2B.id AND R2B.id = IF(P2B.sexe = 1, 'wta', 'atp')
INNER JOIN tournois T on T.id = M.idt
INNER JOIN tournois_name N on N.id = T.id && N.cup = 0
LEFT OUTER JOIN lieux_sites SL on T.ids = SL.id
LEFT OUTER JOIN lieux_villes SC on SL.idv = SC.id
LEFT OUTER JOIN lieux_pays SCO on SCO.code = SC.pays
LEFT OUTER JOIN `livescores_new`.`matchs` LS on LS.tt_match_id = M.id
LEFT OUTER JOIN tournois_programmes S on S.idm = M.id
LEFT OUTER JOIN lieux_courts C on C.ids = S.ids && C.ordre = S.court
WHERE
M.id = '9431612'
&& M.type_tournoi_add = 0
&& (S.statut = 0 || S.statut = 4 || S.statut = 2 || ISNULL(S.statut))
UNION
SELECT
M.*
, M.time_start time_start
, M.time time_end
, M.duration_pause
, M.type_match_add type_match
, M.type_tournoi_add type_tournament
, CR.niveau level
, M.qualif
, M.idw winner_id
, P1.id p1_id
, P1.nom p1_name
, P1.prenom p1_first_name
, P1.name_zh p1_name_zh
, P1.birthday p1_birthday
, P1.sexe p1_gender
, P1.nat p1_nat
, P1.photo p1_photo
, P1.taille p1_height
, P1.poids p1_weight
, R1.rank p1_rank
, R1.liveRank p1_rank_live
, P1.pro_depuis p1_turn_pro
, '?' p1_best_rank
, P1.prise p1_forehand
, P1.revers p1_backhand
, M.ts1 p1_seed
, P1B.id p1b_id
, P1B.nom p1b_name
, P1B.prenom p1b_first_name
, P1B.name_zh p1b_name_zh
, P1B.birthday p1b_birthday
, P1B.sexe p1b_gender
, P1B.nat p1b_nat
, P1B.photo p1b_photo
, P1B.taille p1b_height
, P1B.poids p1b_weight
, R1B.rank p1b_rank
, R1B.liveRank p1b_rank_live
, P1B.pro_depuis p1b_turn_pro
, P2.id p2_id
, P2.nom p2_name
, P2.prenom p2_first_name
, P2.name_zh p2_name_zh
, P2.birthday p2_birthday
, P2.sexe p2_gender
, P2.nat p2_nat
, P2.photo p2_photo
, P2.taille p2_height
, P2.poids p2_weight
, R2.rank p2_rank
, R2.liveRank p2_rank_live
, P2.pro_depuis p2_turn_pro
, '?' p2_best_rank
, P2.prise p2_forehand
, P2.revers p2_backhand
, M.ts2 p2_seed
, P2B.id p2b_id
, P2B.nom p2b_name
, P2B.prenom p2b_first_name
, P2B.name_zh p2b_name_zh
, P2B.birthday p2b_birthday
, P2B.sexe p2b_gender
, P2B.nat p2b_nat
, P2B.photo p2b_photo
, P2B.taille p2b_height
, P2B.poids p2b_weight
, R2B.rank p2b_rank
, R2B.liveRank p2b_rank_live
, P2B.pro_depuis p2b_turn_pro
, C.id tournament_id
, C.parent tournament_idt
, CR.id rencontre_id
, N.name_fr tournament_name_fr
, N.name_en tournament_name_en
, N.name_zh tournament_name_zh
, N.name_de tournament_name_de
, N.name_es tournament_name_es
, CONCAT(CR.equipe_domicile, '|', CR.equipe_exterieur) tournament_city
, '' tournament_stadium
, CR.surface tournament_surface
, '' tournament_surface_photo
, '0' tournament_surface_color
, '' tournament_currency
, '' tournament_prize_money
, SCO.nom_fr tournament_country
, '' tournament_logo
, CR.date_d tournament_start
, '' tournament_end
, C.nbj tournament_nbPlayer
, '' tournament_genre
, '' tournament_category
, '' tournament_type
, CR.lieu tournament_site
, '' tournament_year
, 65 tournament_importance
, IF(T1.nom_fr, T1.nom_fr, CR.equipe_domicile) team1
, IF(T2.nom_fr, T1.nom_fr, CR.equipe_exterieur) team2
, 65 importance
, '' tournament_background
, SC.fuseau_horaire
, IF(ISNULL(LS.status) || M.status = 2 || M.status = 3 || M.status = 4, M.status, LS.status) match_status
, LS.serve
, S.time s_time_start
, S.court
, S.date_loc
, S.type s_type
, S.ordre s_order
, CT.nom court_name
, CT.ordre court_order
FROM
tournois_matchs M
INNER JOIN joueurs P1 on P1.id = M.j1
LEFT OUTER JOIN `joueurs` P1B on P1B.id = M.j1_bis
INNER JOIN joueurs P2 on P2.id = M.j2
LEFT OUTER JOIN `joueurs` P2B on P2B.id = M.j2_bis
LEFT JOIN tennis_rankings R1 on R1.player = P1.id AND R1.id = IF(P1.sexe = 1, 'wta', 'atp')
LEFT JOIN tennis_rankings R1B on R1B.player = P1B.id AND R1B.id = IF(P1B.sexe = 1, 'wta', 'atp')
LEFT JOIN tennis_rankings R2 on R2.player = P2.id AND R2.id = IF(P2.sexe = 1, 'wta', 'atp')
LEFT JOIN tennis_rankings R2B on R2B.player = P2B.id AND R2B.id = IF(P2B.sexe = 1, 'wta', 'atp')
LEFT OUTER JOIN `livescores_new`.`matchs` LS ON (LS.tt_match_id = M.id)
LEFT OUTER JOIN tournois_programmes S on S.idm = M.id
LEFT OUTER JOIN lieux_courts CT on (CT.ids = S.ids && CT.ordre = S.court)
INNER JOIN `coupes_rencontres` CR on CR.id = M.idt
INNER JOIN `coupes` C on C.id = CR.coupe_id
INNER JOIN tournois_name N on N.id = C.id
LEFT JOIN lieux_sites SL on SL.id = CR.lieu
LEFT JOIN lieux_villes SC on SC.id = SL.idv
LEFT JOIN lieux_pays SCO on SCO.code = SC.pays
LEFT JOIN `lieux_pays` T1 ON (T1.code = CR.equipe_domicile)
LEFT JOIN `lieux_pays` T2 ON (T2.code = CR.equipe_exterieur)
WHERE
M.id = '9431612'
&& M.type_tournoi_add = 1
&& (S.statut = 0 || S.statut = 4 || S.statut = 2 || ISNULL(S.statut))
UNION
SELECT
M.*
, M.time_start time_start
, M.time time_end
, M.duration_pause
, M.type_match_add type_match
, M.type_tournoi_add type_tournament
, '' level
, M.qualif
, M.idw winner_id
, P1.id p1_id
, P1.nom p1_name
, P1.prenom p1_first_name
, P1.name_zh p1_name_zh
, P1.birthday p1_birthday
, P1.sexe p1_gender
, P1.nat p1_nat
, P1.photo p1_photo
, P1.taille p1_height
, P1.poids p1_weight
, R1.rank p1_rank
, R1.liveRank p1_rank_live
, P1.pro_depuis p1_turn_pro
, '?' p1_best_rank
, P1.prise p1_forehand
, P1.revers p1_backhand
, M.ts1 p1_seed
, P1B.id p1b_id
, P1B.nom p1b_name
, P1B.prenom p1b_first_name
, P1B.name_zh p1b_name_zh
, P1B.birthday p1b_birthday
, P1B.sexe p1b_gender
, P1B.nat p1b_nat
, P1B.photo p1b_photo
, P1B.taille p1b_height
, P1B.poids p1b_weight
, R1B.rank p1b_rank
, R1B.liveRank p1b_rank_live
, P1B.pro_depuis p1b_turn_pro
, P2.id p2_id
, P2.nom p2_name
, P2.prenom p2_first_name
, P2.name_zh p2_name_zh
, P2.birthday p2_birthday
, P2.sexe p2_gender
, P2.nat p2_nat
, P2.photo p2_photo
, P2.taille p2_height
, P2.poids p2_weight
, R2.rank p2_rank
, R2.liveRank p2_rank_live
, P2.pro_depuis p2_turn_pro
, '?' p2_best_rank
, P2.prise p2_forehand
, P2.revers p2_backhand
, M.ts2 p2_seed
, P2B.id p2b_id
, P2B.nom p2b_name
, P2B.prenom p2b_first_name
, P2B.name_zh p2b_name_zh
, P2B.birthday p2b_birthday
, P2B.sexe p2b_gender
, P2B.nat p2b_nat
, P2B.photo p2b_photo
, P2B.taille p2b_height
, P2B.poids p2b_weight
, R2B.rank p2b_rank
, R2B.liveRank p2b_rank_live
, P2B.pro_depuis p2b_turn_pro
, L.id tournament_id
, 0 tournament_idt
, LR.id rencontre_id
, N.name_fr tournament_name_fr
, N.name_en tournament_name_en
, N.name_zh tournament_name_zh
, N.name_de tournament_name_de
, N.name_es tournament_name_es
, SC.nom tournament_city
, '' tournament_stadium
, '3' tournament_surface
, '' tournament_surface_photo
, '0' tournament_surface_color
, '' tournament_currency
, '' tournament_prize_money
, SCO.nom_fr tournament_country
, '' tournament_logo
, L.time_start tournament_start
, '' tournament_end
, '' tournament_nbPlayer
, '' tournament_genre
, '' tournament_category
, '' tournament_type
, LR.site tournament_site
, L.year tournament_year
, 0 tournament_importance
, '' team1
, '' team2
, 3 importance
, '' tournament_background
, SC.fuseau_horaire
, IF(ISNULL(LS.status) || M.status = 2 || M.status = 3 || M.status = 4, M.status, LS.status) match_status
, LS.serve
, S.time s_time_start
, S.court
, S.date_loc
, S.type s_type
, S.ordre s_order
, CT.nom court_name
, CT.ordre court_order
FROM
tournois_matchs M
JOIN joueurs P1 on P1.id = M.j1
LEFT JOIN `joueurs` P1B on P1B.id = M.j1_bis
JOIN joueurs P2 on P2.id = M.j2
LEFT JOIN `joueurs` P2B on P2B.id = M.j2_bis
LEFT JOIN tennis_rankings R1 on R1.player = P1.id AND R1.id = IF(P1.sexe = 1, 'wta', 'atp')
LEFT JOIN tennis_rankings R1B on R1B.player = P1B.id AND R1B.id = IF(P1B.sexe = 1, 'wta', 'atp')
LEFT JOIN tennis_rankings R2 on R2.player = P2.id AND R2.id = IF(P2.sexe = 1, 'wta', 'atp')
LEFT JOIN tennis_rankings R2B on R2B.player = P2B.id AND R2B.id = IF(P2B.sexe = 1, 'wta', 'atp')
LEFT JOIN `livescores_new`.`matchs` LS ON (LS.tt_match_id = M.id)
LEFT JOIN tournois_programmes S on S.idm = M.id
LEFT JOIN lieux_courts CT on (CT.ids = S.ids && CT.ordre = S.court)
JOIN `leagues_rounds` LR on LR.id = M.league_round
JOIN `leagues` L on L.id = LR.league
JOIN tournois_name N on N.league = L.id
LEFT JOIN lieux_sites SL on SL.id = LR.site
LEFT JOIN lieux_villes SC on SC.id = SL.idv
LEFT JOIN lieux_pays SCO on SCO.code = SC.pays
WHERE
M.id = '9431612'
&& M.type_tournoi_add = 2
&& (S.statut = 0 || S.statut = 4 || S.statut = 2 || ISNULL(S.statut))
LIMIT 1
SELECT M.*
, M.time_start time_start
, M.time time_end
, M.duration_pause
, M.type_match_add type_match
, M.type_tournoi_add type_tournament
, M.niveau level
, M.qualif
, M.idw winner_id
, P1.id p1_id
, P1.nom p1_name
, P1.prenom p1_first_name
, P1.name_zh p1_name_zh
, P1.birthday p1_birthday
, P1.sexe p1_gender
, P1.nat p1_nat
, P1.photo p1_photo
, P1.taille p1_height
, P1.poids p1_weight
, R1.rank p1_rank
, R1.liveRank p1_rank_live
, P1.pro_depuis p1_turn_pro
, '?' p1_best_rank
, P1.prise p1_forehand
, P1.revers p1_backhand
, M.ts1 p1_seed
, P1B.id p1b_id
, P1B.nom p1b_name
, P1B.prenom p1b_first_name
, P1B.name_zh p1b_name_zh
, P1B.birthday p1b_birthday
, P1B.sexe p1b_gender
, P1B.nat p1b_nat
, P1B.photo p1b_photo
, P1B.taille p1b_height
, P1B.poids p1b_weight
, R1B.rank p1b_rank
, R1B.liveRank p1b_rank_live
, P1B.pro_depuis p1b_turn_pro
, P2.id p2_id
, P2.nom p2_name
, P2.prenom p2_first_name
, P2.name_zh p2_name_zh
, P2.birthday p2_birthday
, P2.sexe p2_gender
, P2.nat p2_nat
, P2.photo p2_photo
, P2.taille p2_height
, P2.poids p2_weight
, R2.rank p2_rank
, R2.liveRank p2_rank_live
, P2.pro_depuis p2_turn_pro
, '?' p2_best_rank
, P2.prise p2_forehand
, P2.revers p2_backhand
, M.ts2 p2_seed
, P2B.id p2b_id
, P2B.nom p2b_name
, P2B.prenom p2b_first_name
, P2B.name_zh p2b_name_zh
, P2B.birthday p2b_birthday
, P2B.sexe p2b_gender
, P2B.nat p2b_nat
, P2B.photo p2b_photo
, P2B.taille p2b_height
, P2B.poids p2b_weight
, R2B.rank p2b_rank
, R2B.liveRank p2b_rank_live
, P2B.pro_depuis p2b_turn_pro
, T.id tournament_id
, T.idt tournament_idt
, '?' rencontre_id
, N.name_fr tournament_name_fr
, N.name_en tournament_name_en
, N.name_zh tournament_name_zh
, N.name_de tournament_name_de
, N.name_es tournament_name_es
, T.ville tournament_city
, T.stade tournament_stadium
, T.surface tournament_surface
, T.surface_photo tournament_surface_photo
, T.surface_color tournament_surface_color
, T.monnaie tournament_currency
, T.prix tournament_prize_money
, SCO.nom_fr tournament_country
, T.logo tournament_logo
, T.debut tournament_start
, T.fin tournament_end
, T.nbj tournament_nbPlayer
, T.genre tournament_genre
, T.category tournament_category
, T.type tournament_type
, T.ids tournament_site
, T.year tournament_year
, T.importance tournament_importance
, '' team1
, '' team2
, T.importance
, T.background tournament_background
, SC.fuseau_horaire
, IF(ISNULL(LS.status) || M.status = 2 || M.status = 3 || M.status = 4, M.status, LS.status) match_status
, LS.serve
, S.time s_time_start
, S.court
, S.date_loc
, S.type s_type
, S.ordre s_order
, C.nom court_name
, C.ordre court_order
FROM
tournois_matchs M
INNER JOIN joueurs P1 on P1.id = M.j1
LEFT OUTER JOIN `joueurs` P1B on P1B.id = M.j1_bis
INNER JOIN joueurs P2 on P2.id = M.j2
LEFT OUTER JOIN `joueurs` P2B on P2B.id = M.j2_bis
LEFT JOIN tennis_rankings R1 on R1.player = P1.id AND R1.id = IF(P1.sexe = 1, 'wta', 'atp')
LEFT JOIN tennis_rankings R1B on R1B.player = P1B.id AND R1B.id = IF(P1B.sexe = 1, 'wta', 'atp')
LEFT JOIN tennis_rankings R2 on R2.player = P2.id AND R2.id = IF(P2.sexe = 1, 'wta', 'atp')
LEFT JOIN tennis_rankings R2B on R2B.player = P2B.id AND R2B.id = IF(P2B.sexe = 1, 'wta', 'atp')
INNER JOIN tournois T on T.id = M.idt
INNER JOIN tournois_name N on N.id = T.id && N.cup = 0
LEFT OUTER JOIN lieux_sites SL on T.ids = SL.id
LEFT OUTER JOIN lieux_villes SC on SL.idv = SC.id
LEFT OUTER JOIN lieux_pays SCO on SCO.code = SC.pays
LEFT OUTER JOIN `livescores_new`.`matchs` LS on LS.tt_match_id = M.id
LEFT OUTER JOIN tournois_programmes S on S.idm = M.id
LEFT OUTER JOIN lieux_courts C on C.ids = S.ids && C.ordre = S.court
WHERE
M.id = '9431636'
&& M.type_tournoi_add = 0
&& (S.statut = 0 || S.statut = 4 || S.statut = 2 || ISNULL(S.statut))
UNION
SELECT
M.*
, M.time_start time_start
, M.time time_end
, M.duration_pause
, M.type_match_add type_match
, M.type_tournoi_add type_tournament
, CR.niveau level
, M.qualif
, M.idw winner_id
, P1.id p1_id
, P1.nom p1_name
, P1.prenom p1_first_name
, P1.name_zh p1_name_zh
, P1.birthday p1_birthday
, P1.sexe p1_gender
, P1.nat p1_nat
, P1.photo p1_photo
, P1.taille p1_height
, P1.poids p1_weight
, R1.rank p1_rank
, R1.liveRank p1_rank_live
, P1.pro_depuis p1_turn_pro
, '?' p1_best_rank
, P1.prise p1_forehand
, P1.revers p1_backhand
, M.ts1 p1_seed
, P1B.id p1b_id
, P1B.nom p1b_name
, P1B.prenom p1b_first_name
, P1B.name_zh p1b_name_zh
, P1B.birthday p1b_birthday
, P1B.sexe p1b_gender
, P1B.nat p1b_nat
, P1B.photo p1b_photo
, P1B.taille p1b_height
, P1B.poids p1b_weight
, R1B.rank p1b_rank
, R1B.liveRank p1b_rank_live
, P1B.pro_depuis p1b_turn_pro
, P2.id p2_id
, P2.nom p2_name
, P2.prenom p2_first_name
, P2.name_zh p2_name_zh
, P2.birthday p2_birthday
, P2.sexe p2_gender
, P2.nat p2_nat
, P2.photo p2_photo
, P2.taille p2_height
, P2.poids p2_weight
, R2.rank p2_rank
, R2.liveRank p2_rank_live
, P2.pro_depuis p2_turn_pro
, '?' p2_best_rank
, P2.prise p2_forehand
, P2.revers p2_backhand
, M.ts2 p2_seed
, P2B.id p2b_id
, P2B.nom p2b_name
, P2B.prenom p2b_first_name
, P2B.name_zh p2b_name_zh
, P2B.birthday p2b_birthday
, P2B.sexe p2b_gender
, P2B.nat p2b_nat
, P2B.photo p2b_photo
, P2B.taille p2b_height
, P2B.poids p2b_weight
, R2B.rank p2b_rank
, R2B.liveRank p2b_rank_live
, P2B.pro_depuis p2b_turn_pro
, C.id tournament_id
, C.parent tournament_idt
, CR.id rencontre_id
, N.name_fr tournament_name_fr
, N.name_en tournament_name_en
, N.name_zh tournament_name_zh
, N.name_de tournament_name_de
, N.name_es tournament_name_es
, CONCAT(CR.equipe_domicile, '|', CR.equipe_exterieur) tournament_city
, '' tournament_stadium
, CR.surface tournament_surface
, '' tournament_surface_photo
, '0' tournament_surface_color
, '' tournament_currency
, '' tournament_prize_money
, SCO.nom_fr tournament_country
, '' tournament_logo
, CR.date_d tournament_start
, '' tournament_end
, C.nbj tournament_nbPlayer
, '' tournament_genre
, '' tournament_category
, '' tournament_type
, CR.lieu tournament_site
, '' tournament_year
, 65 tournament_importance
, IF(T1.nom_fr, T1.nom_fr, CR.equipe_domicile) team1
, IF(T2.nom_fr, T1.nom_fr, CR.equipe_exterieur) team2
, 65 importance
, '' tournament_background
, SC.fuseau_horaire
, IF(ISNULL(LS.status) || M.status = 2 || M.status = 3 || M.status = 4, M.status, LS.status) match_status
, LS.serve
, S.time s_time_start
, S.court
, S.date_loc
, S.type s_type
, S.ordre s_order
, CT.nom court_name
, CT.ordre court_order
FROM
tournois_matchs M
INNER JOIN joueurs P1 on P1.id = M.j1
LEFT OUTER JOIN `joueurs` P1B on P1B.id = M.j1_bis
INNER JOIN joueurs P2 on P2.id = M.j2
LEFT OUTER JOIN `joueurs` P2B on P2B.id = M.j2_bis
LEFT JOIN tennis_rankings R1 on R1.player = P1.id AND R1.id = IF(P1.sexe = 1, 'wta', 'atp')
LEFT JOIN tennis_rankings R1B on R1B.player = P1B.id AND R1B.id = IF(P1B.sexe = 1, 'wta', 'atp')
LEFT JOIN tennis_rankings R2 on R2.player = P2.id AND R2.id = IF(P2.sexe = 1, 'wta', 'atp')
LEFT JOIN tennis_rankings R2B on R2B.player = P2B.id AND R2B.id = IF(P2B.sexe = 1, 'wta', 'atp')
LEFT OUTER JOIN `livescores_new`.`matchs` LS ON (LS.tt_match_id = M.id)
LEFT OUTER JOIN tournois_programmes S on S.idm = M.id
LEFT OUTER JOIN lieux_courts CT on (CT.ids = S.ids && CT.ordre = S.court)
INNER JOIN `coupes_rencontres` CR on CR.id = M.idt
INNER JOIN `coupes` C on C.id = CR.coupe_id
INNER JOIN tournois_name N on N.id = C.id
LEFT JOIN lieux_sites SL on SL.id = CR.lieu
LEFT JOIN lieux_villes SC on SC.id = SL.idv
LEFT JOIN lieux_pays SCO on SCO.code = SC.pays
LEFT JOIN `lieux_pays` T1 ON (T1.code = CR.equipe_domicile)
LEFT JOIN `lieux_pays` T2 ON (T2.code = CR.equipe_exterieur)
WHERE
M.id = '9431636'
&& M.type_tournoi_add = 1
&& (S.statut = 0 || S.statut = 4 || S.statut = 2 || ISNULL(S.statut))
UNION
SELECT
M.*
, M.time_start time_start
, M.time time_end
, M.duration_pause
, M.type_match_add type_match
, M.type_tournoi_add type_tournament
, '' level
, M.qualif
, M.idw winner_id
, P1.id p1_id
, P1.nom p1_name
, P1.prenom p1_first_name
, P1.name_zh p1_name_zh
, P1.birthday p1_birthday
, P1.sexe p1_gender
, P1.nat p1_nat
, P1.photo p1_photo
, P1.taille p1_height
, P1.poids p1_weight
, R1.rank p1_rank
, R1.liveRank p1_rank_live
, P1.pro_depuis p1_turn_pro
, '?' p1_best_rank
, P1.prise p1_forehand
, P1.revers p1_backhand
, M.ts1 p1_seed
, P1B.id p1b_id
, P1B.nom p1b_name
, P1B.prenom p1b_first_name
, P1B.name_zh p1b_name_zh
, P1B.birthday p1b_birthday
, P1B.sexe p1b_gender
, P1B.nat p1b_nat
, P1B.photo p1b_photo
, P1B.taille p1b_height
, P1B.poids p1b_weight
, R1B.rank p1b_rank
, R1B.liveRank p1b_rank_live
, P1B.pro_depuis p1b_turn_pro
, P2.id p2_id
, P2.nom p2_name
, P2.prenom p2_first_name
, P2.name_zh p2_name_zh
, P2.birthday p2_birthday
, P2.sexe p2_gender
, P2.nat p2_nat
, P2.photo p2_photo
, P2.taille p2_height
, P2.poids p2_weight
, R2.rank p2_rank
, R2.liveRank p2_rank_live
, P2.pro_depuis p2_turn_pro
, '?' p2_best_rank
, P2.prise p2_forehand
, P2.revers p2_backhand
, M.ts2 p2_seed
, P2B.id p2b_id
, P2B.nom p2b_name
, P2B.prenom p2b_first_name
, P2B.name_zh p2b_name_zh
, P2B.birthday p2b_birthday
, P2B.sexe p2b_gender
, P2B.nat p2b_nat
, P2B.photo p2b_photo
, P2B.taille p2b_height
, P2B.poids p2b_weight
, R2B.rank p2b_rank
, R2B.liveRank p2b_rank_live
, P2B.pro_depuis p2b_turn_pro
, L.id tournament_id
, 0 tournament_idt
, LR.id rencontre_id
, N.name_fr tournament_name_fr
, N.name_en tournament_name_en
, N.name_zh tournament_name_zh
, N.name_de tournament_name_de
, N.name_es tournament_name_es
, SC.nom tournament_city
, '' tournament_stadium
, '3' tournament_surface
, '' tournament_surface_photo
, '0' tournament_surface_color
, '' tournament_currency
, '' tournament_prize_money
, SCO.nom_fr tournament_country
, '' tournament_logo
, L.time_start tournament_start
, '' tournament_end
, '' tournament_nbPlayer
, '' tournament_genre
, '' tournament_category
, '' tournament_type
, LR.site tournament_site
, L.year tournament_year
, 0 tournament_importance
, '' team1
, '' team2
, 3 importance
, '' tournament_background
, SC.fuseau_horaire
, IF(ISNULL(LS.status) || M.status = 2 || M.status = 3 || M.status = 4, M.status, LS.status) match_status
, LS.serve
, S.time s_time_start
, S.court
, S.date_loc
, S.type s_type
, S.ordre s_order
, CT.nom court_name
, CT.ordre court_order
FROM
tournois_matchs M
JOIN joueurs P1 on P1.id = M.j1
LEFT JOIN `joueurs` P1B on P1B.id = M.j1_bis
JOIN joueurs P2 on P2.id = M.j2
LEFT JOIN `joueurs` P2B on P2B.id = M.j2_bis
LEFT JOIN tennis_rankings R1 on R1.player = P1.id AND R1.id = IF(P1.sexe = 1, 'wta', 'atp')
LEFT JOIN tennis_rankings R1B on R1B.player = P1B.id AND R1B.id = IF(P1B.sexe = 1, 'wta', 'atp')
LEFT JOIN tennis_rankings R2 on R2.player = P2.id AND R2.id = IF(P2.sexe = 1, 'wta', 'atp')
LEFT JOIN tennis_rankings R2B on R2B.player = P2B.id AND R2B.id = IF(P2B.sexe = 1, 'wta', 'atp')
LEFT JOIN `livescores_new`.`matchs` LS ON (LS.tt_match_id = M.id)
LEFT JOIN tournois_programmes S on S.idm = M.id
LEFT JOIN lieux_courts CT on (CT.ids = S.ids && CT.ordre = S.court)
JOIN `leagues_rounds` LR on LR.id = M.league_round
JOIN `leagues` L on L.id = LR.league
JOIN tournois_name N on N.league = L.id
LEFT JOIN lieux_sites SL on SL.id = LR.site
LEFT JOIN lieux_villes SC on SC.id = SL.idv
LEFT JOIN lieux_pays SCO on SCO.code = SC.pays
WHERE
M.id = '9431636'
&& M.type_tournoi_add = 2
&& (S.statut = 0 || S.statut = 4 || S.statut = 2 || ISNULL(S.statut))
LIMIT 1
SELECT M.*
, M.time_start time_start
, M.time time_end
, M.duration_pause
, M.type_match_add type_match
, M.type_tournoi_add type_tournament
, M.niveau level
, M.qualif
, M.idw winner_id
, P1.id p1_id
, P1.nom p1_name
, P1.prenom p1_first_name
, P1.name_zh p1_name_zh
, P1.birthday p1_birthday
, P1.sexe p1_gender
, P1.nat p1_nat
, P1.photo p1_photo
, P1.taille p1_height
, P1.poids p1_weight
, R1.rank p1_rank
, R1.liveRank p1_rank_live
, P1.pro_depuis p1_turn_pro
, '?' p1_best_rank
, P1.prise p1_forehand
, P1.revers p1_backhand
, M.ts1 p1_seed
, P1B.id p1b_id
, P1B.nom p1b_name
, P1B.prenom p1b_first_name
, P1B.name_zh p1b_name_zh
, P1B.birthday p1b_birthday
, P1B.sexe p1b_gender
, P1B.nat p1b_nat
, P1B.photo p1b_photo
, P1B.taille p1b_height
, P1B.poids p1b_weight
, R1B.rank p1b_rank
, R1B.liveRank p1b_rank_live
, P1B.pro_depuis p1b_turn_pro
, P2.id p2_id
, P2.nom p2_name
, P2.prenom p2_first_name
, P2.name_zh p2_name_zh
, P2.birthday p2_birthday
, P2.sexe p2_gender
, P2.nat p2_nat
, P2.photo p2_photo
, P2.taille p2_height
, P2.poids p2_weight
, R2.rank p2_rank
, R2.liveRank p2_rank_live
, P2.pro_depuis p2_turn_pro
, '?' p2_best_rank
, P2.prise p2_forehand
, P2.revers p2_backhand
, M.ts2 p2_seed
, P2B.id p2b_id
, P2B.nom p2b_name
, P2B.prenom p2b_first_name
, P2B.name_zh p2b_name_zh
, P2B.birthday p2b_birthday
, P2B.sexe p2b_gender
, P2B.nat p2b_nat
, P2B.photo p2b_photo
, P2B.taille p2b_height
, P2B.poids p2b_weight
, R2B.rank p2b_rank
, R2B.liveRank p2b_rank_live
, P2B.pro_depuis p2b_turn_pro
, T.id tournament_id
, T.idt tournament_idt
, '?' rencontre_id
, N.name_fr tournament_name_fr
, N.name_en tournament_name_en
, N.name_zh tournament_name_zh
, N.name_de tournament_name_de
, N.name_es tournament_name_es
, T.ville tournament_city
, T.stade tournament_stadium
, T.surface tournament_surface
, T.surface_photo tournament_surface_photo
, T.surface_color tournament_surface_color
, T.monnaie tournament_currency
, T.prix tournament_prize_money
, SCO.nom_fr tournament_country
, T.logo tournament_logo
, T.debut tournament_start
, T.fin tournament_end
, T.nbj tournament_nbPlayer
, T.genre tournament_genre
, T.category tournament_category
, T.type tournament_type
, T.ids tournament_site
, T.year tournament_year
, T.importance tournament_importance
, '' team1
, '' team2
, T.importance
, T.background tournament_background
, SC.fuseau_horaire
, IF(ISNULL(LS.status) || M.status = 2 || M.status = 3 || M.status = 4, M.status, LS.status) match_status
, LS.serve
, S.time s_time_start
, S.court
, S.date_loc
, S.type s_type
, S.ordre s_order
, C.nom court_name
, C.ordre court_order
FROM
tournois_matchs M
INNER JOIN joueurs P1 on P1.id = M.j1
LEFT OUTER JOIN `joueurs` P1B on P1B.id = M.j1_bis
INNER JOIN joueurs P2 on P2.id = M.j2
LEFT OUTER JOIN `joueurs` P2B on P2B.id = M.j2_bis
LEFT JOIN tennis_rankings R1 on R1.player = P1.id AND R1.id = IF(P1.sexe = 1, 'wta', 'atp')
LEFT JOIN tennis_rankings R1B on R1B.player = P1B.id AND R1B.id = IF(P1B.sexe = 1, 'wta', 'atp')
LEFT JOIN tennis_rankings R2 on R2.player = P2.id AND R2.id = IF(P2.sexe = 1, 'wta', 'atp')
LEFT JOIN tennis_rankings R2B on R2B.player = P2B.id AND R2B.id = IF(P2B.sexe = 1, 'wta', 'atp')
INNER JOIN tournois T on T.id = M.idt
INNER JOIN tournois_name N on N.id = T.id && N.cup = 0
LEFT OUTER JOIN lieux_sites SL on T.ids = SL.id
LEFT OUTER JOIN lieux_villes SC on SL.idv = SC.id
LEFT OUTER JOIN lieux_pays SCO on SCO.code = SC.pays
LEFT OUTER JOIN `livescores_new`.`matchs` LS on LS.tt_match_id = M.id
LEFT OUTER JOIN tournois_programmes S on S.idm = M.id
LEFT OUTER JOIN lieux_courts C on C.ids = S.ids && C.ordre = S.court
WHERE
M.id = '9431642'
&& M.type_tournoi_add = 0
&& (S.statut = 0 || S.statut = 4 || S.statut = 2 || ISNULL(S.statut))
UNION
SELECT
M.*
, M.time_start time_start
, M.time time_end
, M.duration_pause
, M.type_match_add type_match
, M.type_tournoi_add type_tournament
, CR.niveau level
, M.qualif
, M.idw winner_id
, P1.id p1_id
, P1.nom p1_name
, P1.prenom p1_first_name
, P1.name_zh p1_name_zh
, P1.birthday p1_birthday
, P1.sexe p1_gender
, P1.nat p1_nat
, P1.photo p1_photo
, P1.taille p1_height
, P1.poids p1_weight
, R1.rank p1_rank
, R1.liveRank p1_rank_live
, P1.pro_depuis p1_turn_pro
, '?' p1_best_rank
, P1.prise p1_forehand
, P1.revers p1_backhand
, M.ts1 p1_seed
, P1B.id p1b_id
, P1B.nom p1b_name
, P1B.prenom p1b_first_name
, P1B.name_zh p1b_name_zh
, P1B.birthday p1b_birthday
, P1B.sexe p1b_gender
, P1B.nat p1b_nat
, P1B.photo p1b_photo
, P1B.taille p1b_height
, P1B.poids p1b_weight
, R1B.rank p1b_rank
, R1B.liveRank p1b_rank_live
, P1B.pro_depuis p1b_turn_pro
, P2.id p2_id
, P2.nom p2_name
, P2.prenom p2_first_name
, P2.name_zh p2_name_zh
, P2.birthday p2_birthday
, P2.sexe p2_gender
, P2.nat p2_nat
, P2.photo p2_photo
, P2.taille p2_height
, P2.poids p2_weight
, R2.rank p2_rank
, R2.liveRank p2_rank_live
, P2.pro_depuis p2_turn_pro
, '?' p2_best_rank
, P2.prise p2_forehand
, P2.revers p2_backhand
, M.ts2 p2_seed
, P2B.id p2b_id
, P2B.nom p2b_name
, P2B.prenom p2b_first_name
, P2B.name_zh p2b_name_zh
, P2B.birthday p2b_birthday
, P2B.sexe p2b_gender
, P2B.nat p2b_nat
, P2B.photo p2b_photo
, P2B.taille p2b_height
, P2B.poids p2b_weight
, R2B.rank p2b_rank
, R2B.liveRank p2b_rank_live
, P2B.pro_depuis p2b_turn_pro
, C.id tournament_id
, C.parent tournament_idt
, CR.id rencontre_id
, N.name_fr tournament_name_fr
, N.name_en tournament_name_en
, N.name_zh tournament_name_zh
, N.name_de tournament_name_de
, N.name_es tournament_name_es
, CONCAT(CR.equipe_domicile, '|', CR.equipe_exterieur) tournament_city
, '' tournament_stadium
, CR.surface tournament_surface
, '' tournament_surface_photo
, '0' tournament_surface_color
, '' tournament_currency
, '' tournament_prize_money
, SCO.nom_fr tournament_country
, '' tournament_logo
, CR.date_d tournament_start
, '' tournament_end
, C.nbj tournament_nbPlayer
, '' tournament_genre
, '' tournament_category
, '' tournament_type
, CR.lieu tournament_site
, '' tournament_year
, 65 tournament_importance
, IF(T1.nom_fr, T1.nom_fr, CR.equipe_domicile) team1
, IF(T2.nom_fr, T1.nom_fr, CR.equipe_exterieur) team2
, 65 importance
, '' tournament_background
, SC.fuseau_horaire
, IF(ISNULL(LS.status) || M.status = 2 || M.status = 3 || M.status = 4, M.status, LS.status) match_status
, LS.serve
, S.time s_time_start
, S.court
, S.date_loc
, S.type s_type
, S.ordre s_order
, CT.nom court_name
, CT.ordre court_order
FROM
tournois_matchs M
INNER JOIN joueurs P1 on P1.id = M.j1
LEFT OUTER JOIN `joueurs` P1B on P1B.id = M.j1_bis
INNER JOIN joueurs P2 on P2.id = M.j2
LEFT OUTER JOIN `joueurs` P2B on P2B.id = M.j2_bis
LEFT JOIN tennis_rankings R1 on R1.player = P1.id AND R1.id = IF(P1.sexe = 1, 'wta', 'atp')
LEFT JOIN tennis_rankings R1B on R1B.player = P1B.id AND R1B.id = IF(P1B.sexe = 1, 'wta', 'atp')
LEFT JOIN tennis_rankings R2 on R2.player = P2.id AND R2.id = IF(P2.sexe = 1, 'wta', 'atp')
LEFT JOIN tennis_rankings R2B on R2B.player = P2B.id AND R2B.id = IF(P2B.sexe = 1, 'wta', 'atp')
LEFT OUTER JOIN `livescores_new`.`matchs` LS ON (LS.tt_match_id = M.id)
LEFT OUTER JOIN tournois_programmes S on S.idm = M.id
LEFT OUTER JOIN lieux_courts CT on (CT.ids = S.ids && CT.ordre = S.court)
INNER JOIN `coupes_rencontres` CR on CR.id = M.idt
INNER JOIN `coupes` C on C.id = CR.coupe_id
INNER JOIN tournois_name N on N.id = C.id
LEFT JOIN lieux_sites SL on SL.id = CR.lieu
LEFT JOIN lieux_villes SC on SC.id = SL.idv
LEFT JOIN lieux_pays SCO on SCO.code = SC.pays
LEFT JOIN `lieux_pays` T1 ON (T1.code = CR.equipe_domicile)
LEFT JOIN `lieux_pays` T2 ON (T2.code = CR.equipe_exterieur)
WHERE
M.id = '9431642'
&& M.type_tournoi_add = 1
&& (S.statut = 0 || S.statut = 4 || S.statut = 2 || ISNULL(S.statut))
UNION
SELECT
M.*
, M.time_start time_start
, M.time time_end
, M.duration_pause
, M.type_match_add type_match
, M.type_tournoi_add type_tournament
, '' level
, M.qualif
, M.idw winner_id
, P1.id p1_id
, P1.nom p1_name
, P1.prenom p1_first_name
, P1.name_zh p1_name_zh
, P1.birthday p1_birthday
, P1.sexe p1_gender
, P1.nat p1_nat
, P1.photo p1_photo
, P1.taille p1_height
, P1.poids p1_weight
, R1.rank p1_rank
, R1.liveRank p1_rank_live
, P1.pro_depuis p1_turn_pro
, '?' p1_best_rank
, P1.prise p1_forehand
, P1.revers p1_backhand
, M.ts1 p1_seed
, P1B.id p1b_id
, P1B.nom p1b_name
, P1B.prenom p1b_first_name
, P1B.name_zh p1b_name_zh
, P1B.birthday p1b_birthday
, P1B.sexe p1b_gender
, P1B.nat p1b_nat
, P1B.photo p1b_photo
, P1B.taille p1b_height
, P1B.poids p1b_weight
, R1B.rank p1b_rank
, R1B.liveRank p1b_rank_live
, P1B.pro_depuis p1b_turn_pro
, P2.id p2_id
, P2.nom p2_name
, P2.prenom p2_first_name
, P2.name_zh p2_name_zh
, P2.birthday p2_birthday
, P2.sexe p2_gender
, P2.nat p2_nat
, P2.photo p2_photo
, P2.taille p2_height
, P2.poids p2_weight
, R2.rank p2_rank
, R2.liveRank p2_rank_live
, P2.pro_depuis p2_turn_pro
, '?' p2_best_rank
, P2.prise p2_forehand
, P2.revers p2_backhand
, M.ts2 p2_seed
, P2B.id p2b_id
, P2B.nom p2b_name
, P2B.prenom p2b_first_name
, P2B.name_zh p2b_name_zh
, P2B.birthday p2b_birthday
, P2B.sexe p2b_gender
, P2B.nat p2b_nat
, P2B.photo p2b_photo
, P2B.taille p2b_height
, P2B.poids p2b_weight
, R2B.rank p2b_rank
, R2B.liveRank p2b_rank_live
, P2B.pro_depuis p2b_turn_pro
, L.id tournament_id
, 0 tournament_idt
, LR.id rencontre_id
, N.name_fr tournament_name_fr
, N.name_en tournament_name_en
, N.name_zh tournament_name_zh
, N.name_de tournament_name_de
, N.name_es tournament_name_es
, SC.nom tournament_city
, '' tournament_stadium
, '3' tournament_surface
, '' tournament_surface_photo
, '0' tournament_surface_color
, '' tournament_currency
, '' tournament_prize_money
, SCO.nom_fr tournament_country
, '' tournament_logo
, L.time_start tournament_start
, '' tournament_end
, '' tournament_nbPlayer
, '' tournament_genre
, '' tournament_category
, '' tournament_type
, LR.site tournament_site
, L.year tournament_year
, 0 tournament_importance
, '' team1
, '' team2
, 3 importance
, '' tournament_background
, SC.fuseau_horaire
, IF(ISNULL(LS.status) || M.status = 2 || M.status = 3 || M.status = 4, M.status, LS.status) match_status
, LS.serve
, S.time s_time_start
, S.court
, S.date_loc
, S.type s_type
, S.ordre s_order
, CT.nom court_name
, CT.ordre court_order
FROM
tournois_matchs M
JOIN joueurs P1 on P1.id = M.j1
LEFT JOIN `joueurs` P1B on P1B.id = M.j1_bis
JOIN joueurs P2 on P2.id = M.j2
LEFT JOIN `joueurs` P2B on P2B.id = M.j2_bis
LEFT JOIN tennis_rankings R1 on R1.player = P1.id AND R1.id = IF(P1.sexe = 1, 'wta', 'atp')
LEFT JOIN tennis_rankings R1B on R1B.player = P1B.id AND R1B.id = IF(P1B.sexe = 1, 'wta', 'atp')
LEFT JOIN tennis_rankings R2 on R2.player = P2.id AND R2.id = IF(P2.sexe = 1, 'wta', 'atp')
LEFT JOIN tennis_rankings R2B on R2B.player = P2B.id AND R2B.id = IF(P2B.sexe = 1, 'wta', 'atp')
LEFT JOIN `livescores_new`.`matchs` LS ON (LS.tt_match_id = M.id)
LEFT JOIN tournois_programmes S on S.idm = M.id
LEFT JOIN lieux_courts CT on (CT.ids = S.ids && CT.ordre = S.court)
JOIN `leagues_rounds` LR on LR.id = M.league_round
JOIN `leagues` L on L.id = LR.league
JOIN tournois_name N on N.league = L.id
LEFT JOIN lieux_sites SL on SL.id = LR.site
LEFT JOIN lieux_villes SC on SC.id = SL.idv
LEFT JOIN lieux_pays SCO on SCO.code = SC.pays
WHERE
M.id = '9431642'
&& M.type_tournoi_add = 2
&& (S.statut = 0 || S.statut = 4 || S.statut = 2 || ISNULL(S.statut))
LIMIT 1
SELECT M.*
, M.time_start time_start
, M.time time_end
, M.duration_pause
, M.type_match_add type_match
, M.type_tournoi_add type_tournament
, M.niveau level
, M.qualif
, M.idw winner_id
, P1.id p1_id
, P1.nom p1_name
, P1.prenom p1_first_name
, P1.name_zh p1_name_zh
, P1.birthday p1_birthday
, P1.sexe p1_gender
, P1.nat p1_nat
, P1.photo p1_photo
, P1.taille p1_height
, P1.poids p1_weight
, R1.rank p1_rank
, R1.liveRank p1_rank_live
, P1.pro_depuis p1_turn_pro
, '?' p1_best_rank
, P1.prise p1_forehand
, P1.revers p1_backhand
, M.ts1 p1_seed
, P1B.id p1b_id
, P1B.nom p1b_name
, P1B.prenom p1b_first_name
, P1B.name_zh p1b_name_zh
, P1B.birthday p1b_birthday
, P1B.sexe p1b_gender
, P1B.nat p1b_nat
, P1B.photo p1b_photo
, P1B.taille p1b_height
, P1B.poids p1b_weight
, R1B.rank p1b_rank
, R1B.liveRank p1b_rank_live
, P1B.pro_depuis p1b_turn_pro
, P2.id p2_id
, P2.nom p2_name
, P2.prenom p2_first_name
, P2.name_zh p2_name_zh
, P2.birthday p2_birthday
, P2.sexe p2_gender
, P2.nat p2_nat
, P2.photo p2_photo
, P2.taille p2_height
, P2.poids p2_weight
, R2.rank p2_rank
, R2.liveRank p2_rank_live
, P2.pro_depuis p2_turn_pro
, '?' p2_best_rank
, P2.prise p2_forehand
, P2.revers p2_backhand
, M.ts2 p2_seed
, P2B.id p2b_id
, P2B.nom p2b_name
, P2B.prenom p2b_first_name
, P2B.name_zh p2b_name_zh
, P2B.birthday p2b_birthday
, P2B.sexe p2b_gender
, P2B.nat p2b_nat
, P2B.photo p2b_photo
, P2B.taille p2b_height
, P2B.poids p2b_weight
, R2B.rank p2b_rank
, R2B.liveRank p2b_rank_live
, P2B.pro_depuis p2b_turn_pro
, T.id tournament_id
, T.idt tournament_idt
, '?' rencontre_id
, N.name_fr tournament_name_fr
, N.name_en tournament_name_en
, N.name_zh tournament_name_zh
, N.name_de tournament_name_de
, N.name_es tournament_name_es
, T.ville tournament_city
, T.stade tournament_stadium
, T.surface tournament_surface
, T.surface_photo tournament_surface_photo
, T.surface_color tournament_surface_color
, T.monnaie tournament_currency
, T.prix tournament_prize_money
, SCO.nom_fr tournament_country
, T.logo tournament_logo
, T.debut tournament_start
, T.fin tournament_end
, T.nbj tournament_nbPlayer
, T.genre tournament_genre
, T.category tournament_category
, T.type tournament_type
, T.ids tournament_site
, T.year tournament_year
, T.importance tournament_importance
, '' team1
, '' team2
, T.importance
, T.background tournament_background
, SC.fuseau_horaire
, IF(ISNULL(LS.status) || M.status = 2 || M.status = 3 || M.status = 4, M.status, LS.status) match_status
, LS.serve
, S.time s_time_start
, S.court
, S.date_loc
, S.type s_type
, S.ordre s_order
, C.nom court_name
, C.ordre court_order
FROM
tournois_matchs M
INNER JOIN joueurs P1 on P1.id = M.j1
LEFT OUTER JOIN `joueurs` P1B on P1B.id = M.j1_bis
INNER JOIN joueurs P2 on P2.id = M.j2
LEFT OUTER JOIN `joueurs` P2B on P2B.id = M.j2_bis
LEFT JOIN tennis_rankings R1 on R1.player = P1.id AND R1.id = IF(P1.sexe = 1, 'wta', 'atp')
LEFT JOIN tennis_rankings R1B on R1B.player = P1B.id AND R1B.id = IF(P1B.sexe = 1, 'wta', 'atp')
LEFT JOIN tennis_rankings R2 on R2.player = P2.id AND R2.id = IF(P2.sexe = 1, 'wta', 'atp')
LEFT JOIN tennis_rankings R2B on R2B.player = P2B.id AND R2B.id = IF(P2B.sexe = 1, 'wta', 'atp')
INNER JOIN tournois T on T.id = M.idt
INNER JOIN tournois_name N on N.id = T.id && N.cup = 0
LEFT OUTER JOIN lieux_sites SL on T.ids = SL.id
LEFT OUTER JOIN lieux_villes SC on SL.idv = SC.id
LEFT OUTER JOIN lieux_pays SCO on SCO.code = SC.pays
LEFT OUTER JOIN `livescores_new`.`matchs` LS on LS.tt_match_id = M.id
LEFT OUTER JOIN tournois_programmes S on S.idm = M.id
LEFT OUTER JOIN lieux_courts C on C.ids = S.ids && C.ordre = S.court
WHERE
M.id = '9431625'
&& M.type_tournoi_add = 0
&& (S.statut = 0 || S.statut = 4 || S.statut = 2 || ISNULL(S.statut))
UNION
SELECT
M.*
, M.time_start time_start
, M.time time_end
, M.duration_pause
, M.type_match_add type_match
, M.type_tournoi_add type_tournament
, CR.niveau level
, M.qualif
, M.idw winner_id
, P1.id p1_id
, P1.nom p1_name
, P1.prenom p1_first_name
, P1.name_zh p1_name_zh
, P1.birthday p1_birthday
, P1.sexe p1_gender
, P1.nat p1_nat
, P1.photo p1_photo
, P1.taille p1_height
, P1.poids p1_weight
, R1.rank p1_rank
, R1.liveRank p1_rank_live
, P1.pro_depuis p1_turn_pro
, '?' p1_best_rank
, P1.prise p1_forehand
, P1.revers p1_backhand
, M.ts1 p1_seed
, P1B.id p1b_id
, P1B.nom p1b_name
, P1B.prenom p1b_first_name
, P1B.name_zh p1b_name_zh
, P1B.birthday p1b_birthday
, P1B.sexe p1b_gender
, P1B.nat p1b_nat
, P1B.photo p1b_photo
, P1B.taille p1b_height
, P1B.poids p1b_weight
, R1B.rank p1b_rank
, R1B.liveRank p1b_rank_live
, P1B.pro_depuis p1b_turn_pro
, P2.id p2_id
, P2.nom p2_name
, P2.prenom p2_first_name
, P2.name_zh p2_name_zh
, P2.birthday p2_birthday
, P2.sexe p2_gender
, P2.nat p2_nat
, P2.photo p2_photo
, P2.taille p2_height
, P2.poids p2_weight
, R2.rank p2_rank
, R2.liveRank p2_rank_live
, P2.pro_depuis p2_turn_pro
, '?' p2_best_rank
, P2.prise p2_forehand
, P2.revers p2_backhand
, M.ts2 p2_seed
, P2B.id p2b_id
, P2B.nom p2b_name
, P2B.prenom p2b_first_name
, P2B.name_zh p2b_name_zh
, P2B.birthday p2b_birthday
, P2B.sexe p2b_gender
, P2B.nat p2b_nat
, P2B.photo p2b_photo
, P2B.taille p2b_height
, P2B.poids p2b_weight
, R2B.rank p2b_rank
, R2B.liveRank p2b_rank_live
, P2B.pro_depuis p2b_turn_pro
, C.id tournament_id
, C.parent tournament_idt
, CR.id rencontre_id
, N.name_fr tournament_name_fr
, N.name_en tournament_name_en
, N.name_zh tournament_name_zh
, N.name_de tournament_name_de
, N.name_es tournament_name_es
, CONCAT(CR.equipe_domicile, '|', CR.equipe_exterieur) tournament_city
, '' tournament_stadium
, CR.surface tournament_surface
, '' tournament_surface_photo
, '0' tournament_surface_color
, '' tournament_currency
, '' tournament_prize_money
, SCO.nom_fr tournament_country
, '' tournament_logo
, CR.date_d tournament_start
, '' tournament_end
, C.nbj tournament_nbPlayer
, '' tournament_genre
, '' tournament_category
, '' tournament_type
, CR.lieu tournament_site
, '' tournament_year
, 65 tournament_importance
, IF(T1.nom_fr, T1.nom_fr, CR.equipe_domicile) team1
, IF(T2.nom_fr, T1.nom_fr, CR.equipe_exterieur) team2
, 65 importance
, '' tournament_background
, SC.fuseau_horaire
, IF(ISNULL(LS.status) || M.status = 2 || M.status = 3 || M.status = 4, M.status, LS.status) match_status
, LS.serve
, S.time s_time_start
, S.court
, S.date_loc
, S.type s_type
, S.ordre s_order
, CT.nom court_name
, CT.ordre court_order
FROM
tournois_matchs M
INNER JOIN joueurs P1 on P1.id = M.j1
LEFT OUTER JOIN `joueurs` P1B on P1B.id = M.j1_bis
INNER JOIN joueurs P2 on P2.id = M.j2
LEFT OUTER JOIN `joueurs` P2B on P2B.id = M.j2_bis
LEFT JOIN tennis_rankings R1 on R1.player = P1.id AND R1.id = IF(P1.sexe = 1, 'wta', 'atp')
LEFT JOIN tennis_rankings R1B on R1B.player = P1B.id AND R1B.id = IF(P1B.sexe = 1, 'wta', 'atp')
LEFT JOIN tennis_rankings R2 on R2.player = P2.id AND R2.id = IF(P2.sexe = 1, 'wta', 'atp')
LEFT JOIN tennis_rankings R2B on R2B.player = P2B.id AND R2B.id = IF(P2B.sexe = 1, 'wta', 'atp')
LEFT OUTER JOIN `livescores_new`.`matchs` LS ON (LS.tt_match_id = M.id)
LEFT OUTER JOIN tournois_programmes S on S.idm = M.id
LEFT OUTER JOIN lieux_courts CT on (CT.ids = S.ids && CT.ordre = S.court)
INNER JOIN `coupes_rencontres` CR on CR.id = M.idt
INNER JOIN `coupes` C on C.id = CR.coupe_id
INNER JOIN tournois_name N on N.id = C.id
LEFT JOIN lieux_sites SL on SL.id = CR.lieu
LEFT JOIN lieux_villes SC on SC.id = SL.idv
LEFT JOIN lieux_pays SCO on SCO.code = SC.pays
LEFT JOIN `lieux_pays` T1 ON (T1.code = CR.equipe_domicile)
LEFT JOIN `lieux_pays` T2 ON (T2.code = CR.equipe_exterieur)
WHERE
M.id = '9431625'
&& M.type_tournoi_add = 1
&& (S.statut = 0 || S.statut = 4 || S.statut = 2 || ISNULL(S.statut))
UNION
SELECT
M.*
, M.time_start time_start
, M.time time_end
, M.duration_pause
, M.type_match_add type_match
, M.type_tournoi_add type_tournament
, '' level
, M.qualif
, M.idw winner_id
, P1.id p1_id
, P1.nom p1_name
, P1.prenom p1_first_name
, P1.name_zh p1_name_zh
, P1.birthday p1_birthday
, P1.sexe p1_gender
, P1.nat p1_nat
, P1.photo p1_photo
, P1.taille p1_height
, P1.poids p1_weight
, R1.rank p1_rank
, R1.liveRank p1_rank_live
, P1.pro_depuis p1_turn_pro
, '?' p1_best_rank
, P1.prise p1_forehand
, P1.revers p1_backhand
, M.ts1 p1_seed
, P1B.id p1b_id
, P1B.nom p1b_name
, P1B.prenom p1b_first_name
, P1B.name_zh p1b_name_zh
, P1B.birthday p1b_birthday
, P1B.sexe p1b_gender
, P1B.nat p1b_nat
, P1B.photo p1b_photo
, P1B.taille p1b_height
, P1B.poids p1b_weight
, R1B.rank p1b_rank
, R1B.liveRank p1b_rank_live
, P1B.pro_depuis p1b_turn_pro
, P2.id p2_id
, P2.nom p2_name
, P2.prenom p2_first_name
, P2.name_zh p2_name_zh
, P2.birthday p2_birthday
, P2.sexe p2_gender
, P2.nat p2_nat
, P2.photo p2_photo
, P2.taille p2_height
, P2.poids p2_weight
, R2.rank p2_rank
, R2.liveRank p2_rank_live
, P2.pro_depuis p2_turn_pro
, '?' p2_best_rank
, P2.prise p2_forehand
, P2.revers p2_backhand
, M.ts2 p2_seed
, P2B.id p2b_id
, P2B.nom p2b_name
, P2B.prenom p2b_first_name
, P2B.name_zh p2b_name_zh
, P2B.birthday p2b_birthday
, P2B.sexe p2b_gender
, P2B.nat p2b_nat
, P2B.photo p2b_photo
, P2B.taille p2b_height
, P2B.poids p2b_weight
, R2B.rank p2b_rank
, R2B.liveRank p2b_rank_live
, P2B.pro_depuis p2b_turn_pro
, L.id tournament_id
, 0 tournament_idt
, LR.id rencontre_id
, N.name_fr tournament_name_fr
, N.name_en tournament_name_en
, N.name_zh tournament_name_zh
, N.name_de tournament_name_de
, N.name_es tournament_name_es
, SC.nom tournament_city
, '' tournament_stadium
, '3' tournament_surface
, '' tournament_surface_photo
, '0' tournament_surface_color
, '' tournament_currency
, '' tournament_prize_money
, SCO.nom_fr tournament_country
, '' tournament_logo
, L.time_start tournament_start
, '' tournament_end
, '' tournament_nbPlayer
, '' tournament_genre
, '' tournament_category
, '' tournament_type
, LR.site tournament_site
, L.year tournament_year
, 0 tournament_importance
, '' team1
, '' team2
, 3 importance
, '' tournament_background
, SC.fuseau_horaire
, IF(ISNULL(LS.status) || M.status = 2 || M.status = 3 || M.status = 4, M.status, LS.status) match_status
, LS.serve
, S.time s_time_start
, S.court
, S.date_loc
, S.type s_type
, S.ordre s_order
, CT.nom court_name
, CT.ordre court_order
FROM
tournois_matchs M
JOIN joueurs P1 on P1.id = M.j1
LEFT JOIN `joueurs` P1B on P1B.id = M.j1_bis
JOIN joueurs P2 on P2.id = M.j2
LEFT JOIN `joueurs` P2B on P2B.id = M.j2_bis
LEFT JOIN tennis_rankings R1 on R1.player = P1.id AND R1.id = IF(P1.sexe = 1, 'wta', 'atp')
LEFT JOIN tennis_rankings R1B on R1B.player = P1B.id AND R1B.id = IF(P1B.sexe = 1, 'wta', 'atp')
LEFT JOIN tennis_rankings R2 on R2.player = P2.id AND R2.id = IF(P2.sexe = 1, 'wta', 'atp')
LEFT JOIN tennis_rankings R2B on R2B.player = P2B.id AND R2B.id = IF(P2B.sexe = 1, 'wta', 'atp')
LEFT JOIN `livescores_new`.`matchs` LS ON (LS.tt_match_id = M.id)
LEFT JOIN tournois_programmes S on S.idm = M.id
LEFT JOIN lieux_courts CT on (CT.ids = S.ids && CT.ordre = S.court)
JOIN `leagues_rounds` LR on LR.id = M.league_round
JOIN `leagues` L on L.id = LR.league
JOIN tournois_name N on N.league = L.id
LEFT JOIN lieux_sites SL on SL.id = LR.site
LEFT JOIN lieux_villes SC on SC.id = SL.idv
LEFT JOIN lieux_pays SCO on SCO.code = SC.pays
WHERE
M.id = '9431625'
&& M.type_tournoi_add = 2
&& (S.statut = 0 || S.statut = 4 || S.statut = 2 || ISNULL(S.statut))
LIMIT 1
SELECT M.*
, M.time_start time_start
, M.time time_end
, M.duration_pause
, M.type_match_add type_match
, M.type_tournoi_add type_tournament
, M.niveau level
, M.qualif
, M.idw winner_id
, P1.id p1_id
, P1.nom p1_name
, P1.prenom p1_first_name
, P1.name_zh p1_name_zh
, P1.birthday p1_birthday
, P1.sexe p1_gender
, P1.nat p1_nat
, P1.photo p1_photo
, P1.taille p1_height
, P1.poids p1_weight
, R1.rank p1_rank
, R1.liveRank p1_rank_live
, P1.pro_depuis p1_turn_pro
, '?' p1_best_rank
, P1.prise p1_forehand
, P1.revers p1_backhand
, M.ts1 p1_seed
, P1B.id p1b_id
, P1B.nom p1b_name
, P1B.prenom p1b_first_name
, P1B.name_zh p1b_name_zh
, P1B.birthday p1b_birthday
, P1B.sexe p1b_gender
, P1B.nat p1b_nat
, P1B.photo p1b_photo
, P1B.taille p1b_height
, P1B.poids p1b_weight
, R1B.rank p1b_rank
, R1B.liveRank p1b_rank_live
, P1B.pro_depuis p1b_turn_pro
, P2.id p2_id
, P2.nom p2_name
, P2.prenom p2_first_name
, P2.name_zh p2_name_zh
, P2.birthday p2_birthday
, P2.sexe p2_gender
, P2.nat p2_nat
, P2.photo p2_photo
, P2.taille p2_height
, P2.poids p2_weight
, R2.rank p2_rank
, R2.liveRank p2_rank_live
, P2.pro_depuis p2_turn_pro
, '?' p2_best_rank
, P2.prise p2_forehand
, P2.revers p2_backhand
, M.ts2 p2_seed
, P2B.id p2b_id
, P2B.nom p2b_name
, P2B.prenom p2b_first_name
, P2B.name_zh p2b_name_zh
, P2B.birthday p2b_birthday
, P2B.sexe p2b_gender
, P2B.nat p2b_nat
, P2B.photo p2b_photo
, P2B.taille p2b_height
, P2B.poids p2b_weight
, R2B.rank p2b_rank
, R2B.liveRank p2b_rank_live
, P2B.pro_depuis p2b_turn_pro
, T.id tournament_id
, T.idt tournament_idt
, '?' rencontre_id
, N.name_fr tournament_name_fr
, N.name_en tournament_name_en
, N.name_zh tournament_name_zh
, N.name_de tournament_name_de
, N.name_es tournament_name_es
, T.ville tournament_city
, T.stade tournament_stadium
, T.surface tournament_surface
, T.surface_photo tournament_surface_photo
, T.surface_color tournament_surface_color
, T.monnaie tournament_currency
, T.prix tournament_prize_money
, SCO.nom_fr tournament_country
, T.logo tournament_logo
, T.debut tournament_start
, T.fin tournament_end
, T.nbj tournament_nbPlayer
, T.genre tournament_genre
, T.category tournament_category
, T.type tournament_type
, T.ids tournament_site
, T.year tournament_year
, T.importance tournament_importance
, '' team1
, '' team2
, T.importance
, T.background tournament_background
, SC.fuseau_horaire
, IF(ISNULL(LS.status) || M.status = 2 || M.status = 3 || M.status = 4, M.status, LS.status) match_status
, LS.serve
, S.time s_time_start
, S.court
, S.date_loc
, S.type s_type
, S.ordre s_order
, C.nom court_name
, C.ordre court_order
FROM
tournois_matchs M
INNER JOIN joueurs P1 on P1.id = M.j1
LEFT OUTER JOIN `joueurs` P1B on P1B.id = M.j1_bis
INNER JOIN joueurs P2 on P2.id = M.j2
LEFT OUTER JOIN `joueurs` P2B on P2B.id = M.j2_bis
LEFT JOIN tennis_rankings R1 on R1.player = P1.id AND R1.id = IF(P1.sexe = 1, 'wta', 'atp')
LEFT JOIN tennis_rankings R1B on R1B.player = P1B.id AND R1B.id = IF(P1B.sexe = 1, 'wta', 'atp')
LEFT JOIN tennis_rankings R2 on R2.player = P2.id AND R2.id = IF(P2.sexe = 1, 'wta', 'atp')
LEFT JOIN tennis_rankings R2B on R2B.player = P2B.id AND R2B.id = IF(P2B.sexe = 1, 'wta', 'atp')
INNER JOIN tournois T on T.id = M.idt
INNER JOIN tournois_name N on N.id = T.id && N.cup = 0
LEFT OUTER JOIN lieux_sites SL on T.ids = SL.id
LEFT OUTER JOIN lieux_villes SC on SL.idv = SC.id
LEFT OUTER JOIN lieux_pays SCO on SCO.code = SC.pays
LEFT OUTER JOIN `livescores_new`.`matchs` LS on LS.tt_match_id = M.id
LEFT OUTER JOIN tournois_programmes S on S.idm = M.id
LEFT OUTER JOIN lieux_courts C on C.ids = S.ids && C.ordre = S.court
WHERE
M.id = '9431601'
&& M.type_tournoi_add = 0
&& (S.statut = 0 || S.statut = 4 || S.statut = 2 || ISNULL(S.statut))
UNION
SELECT
M.*
, M.time_start time_start
, M.time time_end
, M.duration_pause
, M.type_match_add type_match
, M.type_tournoi_add type_tournament
, CR.niveau level
, M.qualif
, M.idw winner_id
, P1.id p1_id
, P1.nom p1_name
, P1.prenom p1_first_name
, P1.name_zh p1_name_zh
, P1.birthday p1_birthday
, P1.sexe p1_gender
, P1.nat p1_nat
, P1.photo p1_photo
, P1.taille p1_height
, P1.poids p1_weight
, R1.rank p1_rank
, R1.liveRank p1_rank_live
, P1.pro_depuis p1_turn_pro
, '?' p1_best_rank
, P1.prise p1_forehand
, P1.revers p1_backhand
, M.ts1 p1_seed
, P1B.id p1b_id
, P1B.nom p1b_name
, P1B.prenom p1b_first_name
, P1B.name_zh p1b_name_zh
, P1B.birthday p1b_birthday
, P1B.sexe p1b_gender
, P1B.nat p1b_nat
, P1B.photo p1b_photo
, P1B.taille p1b_height
, P1B.poids p1b_weight
, R1B.rank p1b_rank
, R1B.liveRank p1b_rank_live
, P1B.pro_depuis p1b_turn_pro
, P2.id p2_id
, P2.nom p2_name
, P2.prenom p2_first_name
, P2.name_zh p2_name_zh
, P2.birthday p2_birthday
, P2.sexe p2_gender
, P2.nat p2_nat
, P2.photo p2_photo
, P2.taille p2_height
, P2.poids p2_weight
, R2.rank p2_rank
, R2.liveRank p2_rank_live
, P2.pro_depuis p2_turn_pro
, '?' p2_best_rank
, P2.prise p2_forehand
, P2.revers p2_backhand
, M.ts2 p2_seed
, P2B.id p2b_id
, P2B.nom p2b_name
, P2B.prenom p2b_first_name
, P2B.name_zh p2b_name_zh
, P2B.birthday p2b_birthday
, P2B.sexe p2b_gender
, P2B.nat p2b_nat
, P2B.photo p2b_photo
, P2B.taille p2b_height
, P2B.poids p2b_weight
, R2B.rank p2b_rank
, R2B.liveRank p2b_rank_live
, P2B.pro_depuis p2b_turn_pro
, C.id tournament_id
, C.parent tournament_idt
, CR.id rencontre_id
, N.name_fr tournament_name_fr
, N.name_en tournament_name_en
, N.name_zh tournament_name_zh
, N.name_de tournament_name_de
, N.name_es tournament_name_es
, CONCAT(CR.equipe_domicile, '|', CR.equipe_exterieur) tournament_city
, '' tournament_stadium
, CR.surface tournament_surface
, '' tournament_surface_photo
, '0' tournament_surface_color
, '' tournament_currency
, '' tournament_prize_money
, SCO.nom_fr tournament_country
, '' tournament_logo
, CR.date_d tournament_start
, '' tournament_end
, C.nbj tournament_nbPlayer
, '' tournament_genre
, '' tournament_category
, '' tournament_type
, CR.lieu tournament_site
, '' tournament_year
, 65 tournament_importance
, IF(T1.nom_fr, T1.nom_fr, CR.equipe_domicile) team1
, IF(T2.nom_fr, T1.nom_fr, CR.equipe_exterieur) team2
, 65 importance
, '' tournament_background
, SC.fuseau_horaire
, IF(ISNULL(LS.status) || M.status = 2 || M.status = 3 || M.status = 4, M.status, LS.status) match_status
, LS.serve
, S.time s_time_start
, S.court
, S.date_loc
, S.type s_type
, S.ordre s_order
, CT.nom court_name
, CT.ordre court_order
FROM
tournois_matchs M
INNER JOIN joueurs P1 on P1.id = M.j1
LEFT OUTER JOIN `joueurs` P1B on P1B.id = M.j1_bis
INNER JOIN joueurs P2 on P2.id = M.j2
LEFT OUTER JOIN `joueurs` P2B on P2B.id = M.j2_bis
LEFT JOIN tennis_rankings R1 on R1.player = P1.id AND R1.id = IF(P1.sexe = 1, 'wta', 'atp')
LEFT JOIN tennis_rankings R1B on R1B.player = P1B.id AND R1B.id = IF(P1B.sexe = 1, 'wta', 'atp')
LEFT JOIN tennis_rankings R2 on R2.player = P2.id AND R2.id = IF(P2.sexe = 1, 'wta', 'atp')
LEFT JOIN tennis_rankings R2B on R2B.player = P2B.id AND R2B.id = IF(P2B.sexe = 1, 'wta', 'atp')
LEFT OUTER JOIN `livescores_new`.`matchs` LS ON (LS.tt_match_id = M.id)
LEFT OUTER JOIN tournois_programmes S on S.idm = M.id
LEFT OUTER JOIN lieux_courts CT on (CT.ids = S.ids && CT.ordre = S.court)
INNER JOIN `coupes_rencontres` CR on CR.id = M.idt
INNER JOIN `coupes` C on C.id = CR.coupe_id
INNER JOIN tournois_name N on N.id = C.id
LEFT JOIN lieux_sites SL on SL.id = CR.lieu
LEFT JOIN lieux_villes SC on SC.id = SL.idv
LEFT JOIN lieux_pays SCO on SCO.code = SC.pays
LEFT JOIN `lieux_pays` T1 ON (T1.code = CR.equipe_domicile)
LEFT JOIN `lieux_pays` T2 ON (T2.code = CR.equipe_exterieur)
WHERE
M.id = '9431601'
&& M.type_tournoi_add = 1
&& (S.statut = 0 || S.statut = 4 || S.statut = 2 || ISNULL(S.statut))
UNION
SELECT
M.*
, M.time_start time_start
, M.time time_end
, M.duration_pause
, M.type_match_add type_match
, M.type_tournoi_add type_tournament
, '' level
, M.qualif
, M.idw winner_id
, P1.id p1_id
, P1.nom p1_name
, P1.prenom p1_first_name
, P1.name_zh p1_name_zh
, P1.birthday p1_birthday
, P1.sexe p1_gender
, P1.nat p1_nat
, P1.photo p1_photo
, P1.taille p1_height
, P1.poids p1_weight
, R1.rank p1_rank
, R1.liveRank p1_rank_live
, P1.pro_depuis p1_turn_pro
, '?' p1_best_rank
, P1.prise p1_forehand
, P1.revers p1_backhand
, M.ts1 p1_seed
, P1B.id p1b_id
, P1B.nom p1b_name
, P1B.prenom p1b_first_name
, P1B.name_zh p1b_name_zh
, P1B.birthday p1b_birthday
, P1B.sexe p1b_gender
, P1B.nat p1b_nat
, P1B.photo p1b_photo
, P1B.taille p1b_height
, P1B.poids p1b_weight
, R1B.rank p1b_rank
, R1B.liveRank p1b_rank_live
, P1B.pro_depuis p1b_turn_pro
, P2.id p2_id
, P2.nom p2_name
, P2.prenom p2_first_name
, P2.name_zh p2_name_zh
, P2.birthday p2_birthday
, P2.sexe p2_gender
, P2.nat p2_nat
, P2.photo p2_photo
, P2.taille p2_height
, P2.poids p2_weight
, R2.rank p2_rank
, R2.liveRank p2_rank_live
, P2.pro_depuis p2_turn_pro
, '?' p2_best_rank
, P2.prise p2_forehand
, P2.revers p2_backhand
, M.ts2 p2_seed
, P2B.id p2b_id
, P2B.nom p2b_name
, P2B.prenom p2b_first_name
, P2B.name_zh p2b_name_zh
, P2B.birthday p2b_birthday
, P2B.sexe p2b_gender
, P2B.nat p2b_nat
, P2B.photo p2b_photo
, P2B.taille p2b_height
, P2B.poids p2b_weight
, R2B.rank p2b_rank
, R2B.liveRank p2b_rank_live
, P2B.pro_depuis p2b_turn_pro
, L.id tournament_id
, 0 tournament_idt
, LR.id rencontre_id
, N.name_fr tournament_name_fr
, N.name_en tournament_name_en
, N.name_zh tournament_name_zh
, N.name_de tournament_name_de
, N.name_es tournament_name_es
, SC.nom tournament_city
, '' tournament_stadium
, '3' tournament_surface
, '' tournament_surface_photo
, '0' tournament_surface_color
, '' tournament_currency
, '' tournament_prize_money
, SCO.nom_fr tournament_country
, '' tournament_logo
, L.time_start tournament_start
, '' tournament_end
, '' tournament_nbPlayer
, '' tournament_genre
, '' tournament_category
, '' tournament_type
, LR.site tournament_site
, L.year tournament_year
, 0 tournament_importance
, '' team1
, '' team2
, 3 importance
, '' tournament_background
, SC.fuseau_horaire
, IF(ISNULL(LS.status) || M.status = 2 || M.status = 3 || M.status = 4, M.status, LS.status) match_status
, LS.serve
, S.time s_time_start
, S.court
, S.date_loc
, S.type s_type
, S.ordre s_order
, CT.nom court_name
, CT.ordre court_order
FROM
tournois_matchs M
JOIN joueurs P1 on P1.id = M.j1
LEFT JOIN `joueurs` P1B on P1B.id = M.j1_bis
JOIN joueurs P2 on P2.id = M.j2
LEFT JOIN `joueurs` P2B on P2B.id = M.j2_bis
LEFT JOIN tennis_rankings R1 on R1.player = P1.id AND R1.id = IF(P1.sexe = 1, 'wta', 'atp')
LEFT JOIN tennis_rankings R1B on R1B.player = P1B.id AND R1B.id = IF(P1B.sexe = 1, 'wta', 'atp')
LEFT JOIN tennis_rankings R2 on R2.player = P2.id AND R2.id = IF(P2.sexe = 1, 'wta', 'atp')
LEFT JOIN tennis_rankings R2B on R2B.player = P2B.id AND R2B.id = IF(P2B.sexe = 1, 'wta', 'atp')
LEFT JOIN `livescores_new`.`matchs` LS ON (LS.tt_match_id = M.id)
LEFT JOIN tournois_programmes S on S.idm = M.id
LEFT JOIN lieux_courts CT on (CT.ids = S.ids && CT.ordre = S.court)
JOIN `leagues_rounds` LR on LR.id = M.league_round
JOIN `leagues` L on L.id = LR.league
JOIN tournois_name N on N.league = L.id
LEFT JOIN lieux_sites SL on SL.id = LR.site
LEFT JOIN lieux_villes SC on SC.id = SL.idv
LEFT JOIN lieux_pays SCO on SCO.code = SC.pays
WHERE
M.id = '9431601'
&& M.type_tournoi_add = 2
&& (S.statut = 0 || S.statut = 4 || S.statut = 2 || ISNULL(S.statut))
LIMIT 1
SELECT M.*
, M.time_start time_start
, M.time time_end
, M.duration_pause
, M.type_match_add type_match
, M.type_tournoi_add type_tournament
, M.niveau level
, M.qualif
, M.idw winner_id
, P1.id p1_id
, P1.nom p1_name
, P1.prenom p1_first_name
, P1.name_zh p1_name_zh
, P1.birthday p1_birthday
, P1.sexe p1_gender
, P1.nat p1_nat
, P1.photo p1_photo
, P1.taille p1_height
, P1.poids p1_weight
, R1.rank p1_rank
, R1.liveRank p1_rank_live
, P1.pro_depuis p1_turn_pro
, '?' p1_best_rank
, P1.prise p1_forehand
, P1.revers p1_backhand
, M.ts1 p1_seed
, P1B.id p1b_id
, P1B.nom p1b_name
, P1B.prenom p1b_first_name
, P1B.name_zh p1b_name_zh
, P1B.birthday p1b_birthday
, P1B.sexe p1b_gender
, P1B.nat p1b_nat
, P1B.photo p1b_photo
, P1B.taille p1b_height
, P1B.poids p1b_weight
, R1B.rank p1b_rank
, R1B.liveRank p1b_rank_live
, P1B.pro_depuis p1b_turn_pro
, P2.id p2_id
, P2.nom p2_name
, P2.prenom p2_first_name
, P2.name_zh p2_name_zh
, P2.birthday p2_birthday
, P2.sexe p2_gender
, P2.nat p2_nat
, P2.photo p2_photo
, P2.taille p2_height
, P2.poids p2_weight
, R2.rank p2_rank
, R2.liveRank p2_rank_live
, P2.pro_depuis p2_turn_pro
, '?' p2_best_rank
, P2.prise p2_forehand
, P2.revers p2_backhand
, M.ts2 p2_seed
, P2B.id p2b_id
, P2B.nom p2b_name
, P2B.prenom p2b_first_name
, P2B.name_zh p2b_name_zh
, P2B.birthday p2b_birthday
, P2B.sexe p2b_gender
, P2B.nat p2b_nat
, P2B.photo p2b_photo
, P2B.taille p2b_height
, P2B.poids p2b_weight
, R2B.rank p2b_rank
, R2B.liveRank p2b_rank_live
, P2B.pro_depuis p2b_turn_pro
, T.id tournament_id
, T.idt tournament_idt
, '?' rencontre_id
, N.name_fr tournament_name_fr
, N.name_en tournament_name_en
, N.name_zh tournament_name_zh
, N.name_de tournament_name_de
, N.name_es tournament_name_es
, T.ville tournament_city
, T.stade tournament_stadium
, T.surface tournament_surface
, T.surface_photo tournament_surface_photo
, T.surface_color tournament_surface_color
, T.monnaie tournament_currency
, T.prix tournament_prize_money
, SCO.nom_fr tournament_country
, T.logo tournament_logo
, T.debut tournament_start
, T.fin tournament_end
, T.nbj tournament_nbPlayer
, T.genre tournament_genre
, T.category tournament_category
, T.type tournament_type
, T.ids tournament_site
, T.year tournament_year
, T.importance tournament_importance
, '' team1
, '' team2
, T.importance
, T.background tournament_background
, SC.fuseau_horaire
, IF(ISNULL(LS.status) || M.status = 2 || M.status = 3 || M.status = 4, M.status, LS.status) match_status
, LS.serve
, S.time s_time_start
, S.court
, S.date_loc
, S.type s_type
, S.ordre s_order
, C.nom court_name
, C.ordre court_order
FROM
tournois_matchs M
INNER JOIN joueurs P1 on P1.id = M.j1
LEFT OUTER JOIN `joueurs` P1B on P1B.id = M.j1_bis
INNER JOIN joueurs P2 on P2.id = M.j2
LEFT OUTER JOIN `joueurs` P2B on P2B.id = M.j2_bis
LEFT JOIN tennis_rankings R1 on R1.player = P1.id AND R1.id = IF(P1.sexe = 1, 'wta', 'atp')
LEFT JOIN tennis_rankings R1B on R1B.player = P1B.id AND R1B.id = IF(P1B.sexe = 1, 'wta', 'atp')
LEFT JOIN tennis_rankings R2 on R2.player = P2.id AND R2.id = IF(P2.sexe = 1, 'wta', 'atp')
LEFT JOIN tennis_rankings R2B on R2B.player = P2B.id AND R2B.id = IF(P2B.sexe = 1, 'wta', 'atp')
INNER JOIN tournois T on T.id = M.idt
INNER JOIN tournois_name N on N.id = T.id && N.cup = 0
LEFT OUTER JOIN lieux_sites SL on T.ids = SL.id
LEFT OUTER JOIN lieux_villes SC on SL.idv = SC.id
LEFT OUTER JOIN lieux_pays SCO on SCO.code = SC.pays
LEFT OUTER JOIN `livescores_new`.`matchs` LS on LS.tt_match_id = M.id
LEFT OUTER JOIN tournois_programmes S on S.idm = M.id
LEFT OUTER JOIN lieux_courts C on C.ids = S.ids && C.ordre = S.court
WHERE
M.id = '9431637'
&& M.type_tournoi_add = 0
&& (S.statut = 0 || S.statut = 4 || S.statut = 2 || ISNULL(S.statut))
UNION
SELECT
M.*
, M.time_start time_start
, M.time time_end
, M.duration_pause
, M.type_match_add type_match
, M.type_tournoi_add type_tournament
, CR.niveau level
, M.qualif
, M.idw winner_id
, P1.id p1_id
, P1.nom p1_name
, P1.prenom p1_first_name
, P1.name_zh p1_name_zh
, P1.birthday p1_birthday
, P1.sexe p1_gender
, P1.nat p1_nat
, P1.photo p1_photo
, P1.taille p1_height
, P1.poids p1_weight
, R1.rank p1_rank
, R1.liveRank p1_rank_live
, P1.pro_depuis p1_turn_pro
, '?' p1_best_rank
, P1.prise p1_forehand
, P1.revers p1_backhand
, M.ts1 p1_seed
, P1B.id p1b_id
, P1B.nom p1b_name
, P1B.prenom p1b_first_name
, P1B.name_zh p1b_name_zh
, P1B.birthday p1b_birthday
, P1B.sexe p1b_gender
, P1B.nat p1b_nat
, P1B.photo p1b_photo
, P1B.taille p1b_height
, P1B.poids p1b_weight
, R1B.rank p1b_rank
, R1B.liveRank p1b_rank_live
, P1B.pro_depuis p1b_turn_pro
, P2.id p2_id
, P2.nom p2_name
, P2.prenom p2_first_name
, P2.name_zh p2_name_zh
, P2.birthday p2_birthday
, P2.sexe p2_gender
, P2.nat p2_nat
, P2.photo p2_photo
, P2.taille p2_height
, P2.poids p2_weight
, R2.rank p2_rank
, R2.liveRank p2_rank_live
, P2.pro_depuis p2_turn_pro
, '?' p2_best_rank
, P2.prise p2_forehand
, P2.revers p2_backhand
, M.ts2 p2_seed
, P2B.id p2b_id
, P2B.nom p2b_name
, P2B.prenom p2b_first_name
, P2B.name_zh p2b_name_zh
, P2B.birthday p2b_birthday
, P2B.sexe p2b_gender
, P2B.nat p2b_nat
, P2B.photo p2b_photo
, P2B.taille p2b_height
, P2B.poids p2b_weight
, R2B.rank p2b_rank
, R2B.liveRank p2b_rank_live
, P2B.pro_depuis p2b_turn_pro
, C.id tournament_id
, C.parent tournament_idt
, CR.id rencontre_id
, N.name_fr tournament_name_fr
, N.name_en tournament_name_en
, N.name_zh tournament_name_zh
, N.name_de tournament_name_de
, N.name_es tournament_name_es
, CONCAT(CR.equipe_domicile, '|', CR.equipe_exterieur) tournament_city
, '' tournament_stadium
, CR.surface tournament_surface
, '' tournament_surface_photo
, '0' tournament_surface_color
, '' tournament_currency
, '' tournament_prize_money
, SCO.nom_fr tournament_country
, '' tournament_logo
, CR.date_d tournament_start
, '' tournament_end
, C.nbj tournament_nbPlayer
, '' tournament_genre
, '' tournament_category
, '' tournament_type
, CR.lieu tournament_site
, '' tournament_year
, 65 tournament_importance
, IF(T1.nom_fr, T1.nom_fr, CR.equipe_domicile) team1
, IF(T2.nom_fr, T1.nom_fr, CR.equipe_exterieur) team2
, 65 importance
, '' tournament_background
, SC.fuseau_horaire
, IF(ISNULL(LS.status) || M.status = 2 || M.status = 3 || M.status = 4, M.status, LS.status) match_status
, LS.serve
, S.time s_time_start
, S.court
, S.date_loc
, S.type s_type
, S.ordre s_order
, CT.nom court_name
, CT.ordre court_order
FROM
tournois_matchs M
INNER JOIN joueurs P1 on P1.id = M.j1
LEFT OUTER JOIN `joueurs` P1B on P1B.id = M.j1_bis
INNER JOIN joueurs P2 on P2.id = M.j2
LEFT OUTER JOIN `joueurs` P2B on P2B.id = M.j2_bis
LEFT JOIN tennis_rankings R1 on R1.player = P1.id AND R1.id = IF(P1.sexe = 1, 'wta', 'atp')
LEFT JOIN tennis_rankings R1B on R1B.player = P1B.id AND R1B.id = IF(P1B.sexe = 1, 'wta', 'atp')
LEFT JOIN tennis_rankings R2 on R2.player = P2.id AND R2.id = IF(P2.sexe = 1, 'wta', 'atp')
LEFT JOIN tennis_rankings R2B on R2B.player = P2B.id AND R2B.id = IF(P2B.sexe = 1, 'wta', 'atp')
LEFT OUTER JOIN `livescores_new`.`matchs` LS ON (LS.tt_match_id = M.id)
LEFT OUTER JOIN tournois_programmes S on S.idm = M.id
LEFT OUTER JOIN lieux_courts CT on (CT.ids = S.ids && CT.ordre = S.court)
INNER JOIN `coupes_rencontres` CR on CR.id = M.idt
INNER JOIN `coupes` C on C.id = CR.coupe_id
INNER JOIN tournois_name N on N.id = C.id
LEFT JOIN lieux_sites SL on SL.id = CR.lieu
LEFT JOIN lieux_villes SC on SC.id = SL.idv
LEFT JOIN lieux_pays SCO on SCO.code = SC.pays
LEFT JOIN `lieux_pays` T1 ON (T1.code = CR.equipe_domicile)
LEFT JOIN `lieux_pays` T2 ON (T2.code = CR.equipe_exterieur)
WHERE
M.id = '9431637'
&& M.type_tournoi_add = 1
&& (S.statut = 0 || S.statut = 4 || S.statut = 2 || ISNULL(S.statut))
UNION
SELECT
M.*
, M.time_start time_start
, M.time time_end
, M.duration_pause
, M.type_match_add type_match
, M.type_tournoi_add type_tournament
, '' level
, M.qualif
, M.idw winner_id
, P1.id p1_id
, P1.nom p1_name
, P1.prenom p1_first_name
, P1.name_zh p1_name_zh
, P1.birthday p1_birthday
, P1.sexe p1_gender
, P1.nat p1_nat
, P1.photo p1_photo
, P1.taille p1_height
, P1.poids p1_weight
, R1.rank p1_rank
, R1.liveRank p1_rank_live
, P1.pro_depuis p1_turn_pro
, '?' p1_best_rank
, P1.prise p1_forehand
, P1.revers p1_backhand
, M.ts1 p1_seed
, P1B.id p1b_id
, P1B.nom p1b_name
, P1B.prenom p1b_first_name
, P1B.name_zh p1b_name_zh
, P1B.birthday p1b_birthday
, P1B.sexe p1b_gender
, P1B.nat p1b_nat
, P1B.photo p1b_photo
, P1B.taille p1b_height
, P1B.poids p1b_weight
, R1B.rank p1b_rank
, R1B.liveRank p1b_rank_live
, P1B.pro_depuis p1b_turn_pro
, P2.id p2_id
, P2.nom p2_name
, P2.prenom p2_first_name
, P2.name_zh p2_name_zh
, P2.birthday p2_birthday
, P2.sexe p2_gender
, P2.nat p2_nat
, P2.photo p2_photo
, P2.taille p2_height
, P2.poids p2_weight
, R2.rank p2_rank
, R2.liveRank p2_rank_live
, P2.pro_depuis p2_turn_pro
, '?' p2_best_rank
, P2.prise p2_forehand
, P2.revers p2_backhand
, M.ts2 p2_seed
, P2B.id p2b_id
, P2B.nom p2b_name
, P2B.prenom p2b_first_name
, P2B.name_zh p2b_name_zh
, P2B.birthday p2b_birthday
, P2B.sexe p2b_gender
, P2B.nat p2b_nat
, P2B.photo p2b_photo
, P2B.taille p2b_height
, P2B.poids p2b_weight
, R2B.rank p2b_rank
, R2B.liveRank p2b_rank_live
, P2B.pro_depuis p2b_turn_pro
, L.id tournament_id
, 0 tournament_idt
, LR.id rencontre_id
, N.name_fr tournament_name_fr
, N.name_en tournament_name_en
, N.name_zh tournament_name_zh
, N.name_de tournament_name_de
, N.name_es tournament_name_es
, SC.nom tournament_city
, '' tournament_stadium
, '3' tournament_surface
, '' tournament_surface_photo
, '0' tournament_surface_color
, '' tournament_currency
, '' tournament_prize_money
, SCO.nom_fr tournament_country
, '' tournament_logo
, L.time_start tournament_start
, '' tournament_end
, '' tournament_nbPlayer
, '' tournament_genre
, '' tournament_category
, '' tournament_type
, LR.site tournament_site
, L.year tournament_year
, 0 tournament_importance
, '' team1
, '' team2
, 3 importance
, '' tournament_background
, SC.fuseau_horaire
, IF(ISNULL(LS.status) || M.status = 2 || M.status = 3 || M.status = 4, M.status, LS.status) match_status
, LS.serve
, S.time s_time_start
, S.court
, S.date_loc
, S.type s_type
, S.ordre s_order
, CT.nom court_name
, CT.ordre court_order
FROM
tournois_matchs M
JOIN joueurs P1 on P1.id = M.j1
LEFT JOIN `joueurs` P1B on P1B.id = M.j1_bis
JOIN joueurs P2 on P2.id = M.j2
LEFT JOIN `joueurs` P2B on P2B.id = M.j2_bis
LEFT JOIN tennis_rankings R1 on R1.player = P1.id AND R1.id = IF(P1.sexe = 1, 'wta', 'atp')
LEFT JOIN tennis_rankings R1B on R1B.player = P1B.id AND R1B.id = IF(P1B.sexe = 1, 'wta', 'atp')
LEFT JOIN tennis_rankings R2 on R2.player = P2.id AND R2.id = IF(P2.sexe = 1, 'wta', 'atp')
LEFT JOIN tennis_rankings R2B on R2B.player = P2B.id AND R2B.id = IF(P2B.sexe = 1, 'wta', 'atp')
LEFT JOIN `livescores_new`.`matchs` LS ON (LS.tt_match_id = M.id)
LEFT JOIN tournois_programmes S on S.idm = M.id
LEFT JOIN lieux_courts CT on (CT.ids = S.ids && CT.ordre = S.court)
JOIN `leagues_rounds` LR on LR.id = M.league_round
JOIN `leagues` L on L.id = LR.league
JOIN tournois_name N on N.league = L.id
LEFT JOIN lieux_sites SL on SL.id = LR.site
LEFT JOIN lieux_villes SC on SC.id = SL.idv
LEFT JOIN lieux_pays SCO on SCO.code = SC.pays
WHERE
M.id = '9431637'
&& M.type_tournoi_add = 2
&& (S.statut = 0 || S.statut = 4 || S.statut = 2 || ISNULL(S.statut))
LIMIT 1
SELECT M.*
, M.time_start time_start
, M.time time_end
, M.duration_pause
, M.type_match_add type_match
, M.type_tournoi_add type_tournament
, M.niveau level
, M.qualif
, M.idw winner_id
, P1.id p1_id
, P1.nom p1_name
, P1.prenom p1_first_name
, P1.name_zh p1_name_zh
, P1.birthday p1_birthday
, P1.sexe p1_gender
, P1.nat p1_nat
, P1.photo p1_photo
, P1.taille p1_height
, P1.poids p1_weight
, R1.rank p1_rank
, R1.liveRank p1_rank_live
, P1.pro_depuis p1_turn_pro
, '?' p1_best_rank
, P1.prise p1_forehand
, P1.revers p1_backhand
, M.ts1 p1_seed
, P1B.id p1b_id
, P1B.nom p1b_name
, P1B.prenom p1b_first_name
, P1B.name_zh p1b_name_zh
, P1B.birthday p1b_birthday
, P1B.sexe p1b_gender
, P1B.nat p1b_nat
, P1B.photo p1b_photo
, P1B.taille p1b_height
, P1B.poids p1b_weight
, R1B.rank p1b_rank
, R1B.liveRank p1b_rank_live
, P1B.pro_depuis p1b_turn_pro
, P2.id p2_id
, P2.nom p2_name
, P2.prenom p2_first_name
, P2.name_zh p2_name_zh
, P2.birthday p2_birthday
, P2.sexe p2_gender
, P2.nat p2_nat
, P2.photo p2_photo
, P2.taille p2_height
, P2.poids p2_weight
, R2.rank p2_rank
, R2.liveRank p2_rank_live
, P2.pro_depuis p2_turn_pro
, '?' p2_best_rank
, P2.prise p2_forehand
, P2.revers p2_backhand
, M.ts2 p2_seed
, P2B.id p2b_id
, P2B.nom p2b_name
, P2B.prenom p2b_first_name
, P2B.name_zh p2b_name_zh
, P2B.birthday p2b_birthday
, P2B.sexe p2b_gender
, P2B.nat p2b_nat
, P2B.photo p2b_photo
, P2B.taille p2b_height
, P2B.poids p2b_weight
, R2B.rank p2b_rank
, R2B.liveRank p2b_rank_live
, P2B.pro_depuis p2b_turn_pro
, T.id tournament_id
, T.idt tournament_idt
, '?' rencontre_id
, N.name_fr tournament_name_fr
, N.name_en tournament_name_en
, N.name_zh tournament_name_zh
, N.name_de tournament_name_de
, N.name_es tournament_name_es
, T.ville tournament_city
, T.stade tournament_stadium
, T.surface tournament_surface
, T.surface_photo tournament_surface_photo
, T.surface_color tournament_surface_color
, T.monnaie tournament_currency
, T.prix tournament_prize_money
, SCO.nom_fr tournament_country
, T.logo tournament_logo
, T.debut tournament_start
, T.fin tournament_end
, T.nbj tournament_nbPlayer
, T.genre tournament_genre
, T.category tournament_category
, T.type tournament_type
, T.ids tournament_site
, T.year tournament_year
, T.importance tournament_importance
, '' team1
, '' team2
, T.importance
, T.background tournament_background
, SC.fuseau_horaire
, IF(ISNULL(LS.status) || M.status = 2 || M.status = 3 || M.status = 4, M.status, LS.status) match_status
, LS.serve
, S.time s_time_start
, S.court
, S.date_loc
, S.type s_type
, S.ordre s_order
, C.nom court_name
, C.ordre court_order
FROM
tournois_matchs M
INNER JOIN joueurs P1 on P1.id = M.j1
LEFT OUTER JOIN `joueurs` P1B on P1B.id = M.j1_bis
INNER JOIN joueurs P2 on P2.id = M.j2
LEFT OUTER JOIN `joueurs` P2B on P2B.id = M.j2_bis
LEFT JOIN tennis_rankings R1 on R1.player = P1.id AND R1.id = IF(P1.sexe = 1, 'wta', 'atp')
LEFT JOIN tennis_rankings R1B on R1B.player = P1B.id AND R1B.id = IF(P1B.sexe = 1, 'wta', 'atp')
LEFT JOIN tennis_rankings R2 on R2.player = P2.id AND R2.id = IF(P2.sexe = 1, 'wta', 'atp')
LEFT JOIN tennis_rankings R2B on R2B.player = P2B.id AND R2B.id = IF(P2B.sexe = 1, 'wta', 'atp')
INNER JOIN tournois T on T.id = M.idt
INNER JOIN tournois_name N on N.id = T.id && N.cup = 0
LEFT OUTER JOIN lieux_sites SL on T.ids = SL.id
LEFT OUTER JOIN lieux_villes SC on SL.idv = SC.id
LEFT OUTER JOIN lieux_pays SCO on SCO.code = SC.pays
LEFT OUTER JOIN `livescores_new`.`matchs` LS on LS.tt_match_id = M.id
LEFT OUTER JOIN tournois_programmes S on S.idm = M.id
LEFT OUTER JOIN lieux_courts C on C.ids = S.ids && C.ordre = S.court
WHERE
M.id = '9431607'
&& M.type_tournoi_add = 0
&& (S.statut = 0 || S.statut = 4 || S.statut = 2 || ISNULL(S.statut))
UNION
SELECT
M.*
, M.time_start time_start
, M.time time_end
, M.duration_pause
, M.type_match_add type_match
, M.type_tournoi_add type_tournament
, CR.niveau level
, M.qualif
, M.idw winner_id
, P1.id p1_id
, P1.nom p1_name
, P1.prenom p1_first_name
, P1.name_zh p1_name_zh
, P1.birthday p1_birthday
, P1.sexe p1_gender
, P1.nat p1_nat
, P1.photo p1_photo
, P1.taille p1_height
, P1.poids p1_weight
, R1.rank p1_rank
, R1.liveRank p1_rank_live
, P1.pro_depuis p1_turn_pro
, '?' p1_best_rank
, P1.prise p1_forehand
, P1.revers p1_backhand
, M.ts1 p1_seed
, P1B.id p1b_id
, P1B.nom p1b_name
, P1B.prenom p1b_first_name
, P1B.name_zh p1b_name_zh
, P1B.birthday p1b_birthday
, P1B.sexe p1b_gender
, P1B.nat p1b_nat
, P1B.photo p1b_photo
, P1B.taille p1b_height
, P1B.poids p1b_weight
, R1B.rank p1b_rank
, R1B.liveRank p1b_rank_live
, P1B.pro_depuis p1b_turn_pro
, P2.id p2_id
, P2.nom p2_name
, P2.prenom p2_first_name
, P2.name_zh p2_name_zh
, P2.birthday p2_birthday
, P2.sexe p2_gender
, P2.nat p2_nat
, P2.photo p2_photo
, P2.taille p2_height
, P2.poids p2_weight
, R2.rank p2_rank
, R2.liveRank p2_rank_live
, P2.pro_depuis p2_turn_pro
, '?' p2_best_rank
, P2.prise p2_forehand
, P2.revers p2_backhand
, M.ts2 p2_seed
, P2B.id p2b_id
, P2B.nom p2b_name
, P2B.prenom p2b_first_name
, P2B.name_zh p2b_name_zh
, P2B.birthday p2b_birthday
, P2B.sexe p2b_gender
, P2B.nat p2b_nat
, P2B.photo p2b_photo
, P2B.taille p2b_height
, P2B.poids p2b_weight
, R2B.rank p2b_rank
, R2B.liveRank p2b_rank_live
, P2B.pro_depuis p2b_turn_pro
, C.id tournament_id
, C.parent tournament_idt
, CR.id rencontre_id
, N.name_fr tournament_name_fr
, N.name_en tournament_name_en
, N.name_zh tournament_name_zh
, N.name_de tournament_name_de
, N.name_es tournament_name_es
, CONCAT(CR.equipe_domicile, '|', CR.equipe_exterieur) tournament_city
, '' tournament_stadium
, CR.surface tournament_surface
, '' tournament_surface_photo
, '0' tournament_surface_color
, '' tournament_currency
, '' tournament_prize_money
, SCO.nom_fr tournament_country
, '' tournament_logo
, CR.date_d tournament_start
, '' tournament_end
, C.nbj tournament_nbPlayer
, '' tournament_genre
, '' tournament_category
, '' tournament_type
, CR.lieu tournament_site
, '' tournament_year
, 65 tournament_importance
, IF(T1.nom_fr, T1.nom_fr, CR.equipe_domicile) team1
, IF(T2.nom_fr, T1.nom_fr, CR.equipe_exterieur) team2
, 65 importance
, '' tournament_background
, SC.fuseau_horaire
, IF(ISNULL(LS.status) || M.status = 2 || M.status = 3 || M.status = 4, M.status, LS.status) match_status
, LS.serve
, S.time s_time_start
, S.court
, S.date_loc
, S.type s_type
, S.ordre s_order
, CT.nom court_name
, CT.ordre court_order
FROM
tournois_matchs M
INNER JOIN joueurs P1 on P1.id = M.j1
LEFT OUTER JOIN `joueurs` P1B on P1B.id = M.j1_bis
INNER JOIN joueurs P2 on P2.id = M.j2
LEFT OUTER JOIN `joueurs` P2B on P2B.id = M.j2_bis
LEFT JOIN tennis_rankings R1 on R1.player = P1.id AND R1.id = IF(P1.sexe = 1, 'wta', 'atp')
LEFT JOIN tennis_rankings R1B on R1B.player = P1B.id AND R1B.id = IF(P1B.sexe = 1, 'wta', 'atp')
LEFT JOIN tennis_rankings R2 on R2.player = P2.id AND R2.id = IF(P2.sexe = 1, 'wta', 'atp')
LEFT JOIN tennis_rankings R2B on R2B.player = P2B.id AND R2B.id = IF(P2B.sexe = 1, 'wta', 'atp')
LEFT OUTER JOIN `livescores_new`.`matchs` LS ON (LS.tt_match_id = M.id)
LEFT OUTER JOIN tournois_programmes S on S.idm = M.id
LEFT OUTER JOIN lieux_courts CT on (CT.ids = S.ids && CT.ordre = S.court)
INNER JOIN `coupes_rencontres` CR on CR.id = M.idt
INNER JOIN `coupes` C on C.id = CR.coupe_id
INNER JOIN tournois_name N on N.id = C.id
LEFT JOIN lieux_sites SL on SL.id = CR.lieu
LEFT JOIN lieux_villes SC on SC.id = SL.idv
LEFT JOIN lieux_pays SCO on SCO.code = SC.pays
LEFT JOIN `lieux_pays` T1 ON (T1.code = CR.equipe_domicile)
LEFT JOIN `lieux_pays` T2 ON (T2.code = CR.equipe_exterieur)
WHERE
M.id = '9431607'
&& M.type_tournoi_add = 1
&& (S.statut = 0 || S.statut = 4 || S.statut = 2 || ISNULL(S.statut))
UNION
SELECT
M.*
, M.time_start time_start
, M.time time_end
, M.duration_pause
, M.type_match_add type_match
, M.type_tournoi_add type_tournament
, '' level
, M.qualif
, M.idw winner_id
, P1.id p1_id
, P1.nom p1_name
, P1.prenom p1_first_name
, P1.name_zh p1_name_zh
, P1.birthday p1_birthday
, P1.sexe p1_gender
, P1.nat p1_nat
, P1.photo p1_photo
, P1.taille p1_height
, P1.poids p1_weight
, R1.rank p1_rank
, R1.liveRank p1_rank_live
, P1.pro_depuis p1_turn_pro
, '?' p1_best_rank
, P1.prise p1_forehand
, P1.revers p1_backhand
, M.ts1 p1_seed
, P1B.id p1b_id
, P1B.nom p1b_name
, P1B.prenom p1b_first_name
, P1B.name_zh p1b_name_zh
, P1B.birthday p1b_birthday
, P1B.sexe p1b_gender
, P1B.nat p1b_nat
, P1B.photo p1b_photo
, P1B.taille p1b_height
, P1B.poids p1b_weight
, R1B.rank p1b_rank
, R1B.liveRank p1b_rank_live
, P1B.pro_depuis p1b_turn_pro
, P2.id p2_id
, P2.nom p2_name
, P2.prenom p2_first_name
, P2.name_zh p2_name_zh
, P2.birthday p2_birthday
, P2.sexe p2_gender
, P2.nat p2_nat
, P2.photo p2_photo
, P2.taille p2_height
, P2.poids p2_weight
, R2.rank p2_rank
, R2.liveRank p2_rank_live
, P2.pro_depuis p2_turn_pro
, '?' p2_best_rank
, P2.prise p2_forehand
, P2.revers p2_backhand
, M.ts2 p2_seed
, P2B.id p2b_id
, P2B.nom p2b_name
, P2B.prenom p2b_first_name
, P2B.name_zh p2b_name_zh
, P2B.birthday p2b_birthday
, P2B.sexe p2b_gender
, P2B.nat p2b_nat
, P2B.photo p2b_photo
, P2B.taille p2b_height
, P2B.poids p2b_weight
, R2B.rank p2b_rank
, R2B.liveRank p2b_rank_live
, P2B.pro_depuis p2b_turn_pro
, L.id tournament_id
, 0 tournament_idt
, LR.id rencontre_id
, N.name_fr tournament_name_fr
, N.name_en tournament_name_en
, N.name_zh tournament_name_zh
, N.name_de tournament_name_de
, N.name_es tournament_name_es
, SC.nom tournament_city
, '' tournament_stadium
, '3' tournament_surface
, '' tournament_surface_photo
, '0' tournament_surface_color
, '' tournament_currency
, '' tournament_prize_money
, SCO.nom_fr tournament_country
, '' tournament_logo
, L.time_start tournament_start
, '' tournament_end
, '' tournament_nbPlayer
, '' tournament_genre
, '' tournament_category
, '' tournament_type
, LR.site tournament_site
, L.year tournament_year
, 0 tournament_importance
, '' team1
, '' team2
, 3 importance
, '' tournament_background
, SC.fuseau_horaire
, IF(ISNULL(LS.status) || M.status = 2 || M.status = 3 || M.status = 4, M.status, LS.status) match_status
, LS.serve
, S.time s_time_start
, S.court
, S.date_loc
, S.type s_type
, S.ordre s_order
, CT.nom court_name
, CT.ordre court_order
FROM
tournois_matchs M
JOIN joueurs P1 on P1.id = M.j1
LEFT JOIN `joueurs` P1B on P1B.id = M.j1_bis
JOIN joueurs P2 on P2.id = M.j2
LEFT JOIN `joueurs` P2B on P2B.id = M.j2_bis
LEFT JOIN tennis_rankings R1 on R1.player = P1.id AND R1.id = IF(P1.sexe = 1, 'wta', 'atp')
LEFT JOIN tennis_rankings R1B on R1B.player = P1B.id AND R1B.id = IF(P1B.sexe = 1, 'wta', 'atp')
LEFT JOIN tennis_rankings R2 on R2.player = P2.id AND R2.id = IF(P2.sexe = 1, 'wta', 'atp')
LEFT JOIN tennis_rankings R2B on R2B.player = P2B.id AND R2B.id = IF(P2B.sexe = 1, 'wta', 'atp')
LEFT JOIN `livescores_new`.`matchs` LS ON (LS.tt_match_id = M.id)
LEFT JOIN tournois_programmes S on S.idm = M.id
LEFT JOIN lieux_courts CT on (CT.ids = S.ids && CT.ordre = S.court)
JOIN `leagues_rounds` LR on LR.id = M.league_round
JOIN `leagues` L on L.id = LR.league
JOIN tournois_name N on N.league = L.id
LEFT JOIN lieux_sites SL on SL.id = LR.site
LEFT JOIN lieux_villes SC on SC.id = SL.idv
LEFT JOIN lieux_pays SCO on SCO.code = SC.pays
WHERE
M.id = '9431607'
&& M.type_tournoi_add = 2
&& (S.statut = 0 || S.statut = 4 || S.statut = 2 || ISNULL(S.statut))
LIMIT 1
SELECT M.*
, M.time_start time_start
, M.time time_end
, M.duration_pause
, M.type_match_add type_match
, M.type_tournoi_add type_tournament
, M.niveau level
, M.qualif
, M.idw winner_id
, P1.id p1_id
, P1.nom p1_name
, P1.prenom p1_first_name
, P1.name_zh p1_name_zh
, P1.birthday p1_birthday
, P1.sexe p1_gender
, P1.nat p1_nat
, P1.photo p1_photo
, P1.taille p1_height
, P1.poids p1_weight
, R1.rank p1_rank
, R1.liveRank p1_rank_live
, P1.pro_depuis p1_turn_pro
, '?' p1_best_rank
, P1.prise p1_forehand
, P1.revers p1_backhand
, M.ts1 p1_seed
, P1B.id p1b_id
, P1B.nom p1b_name
, P1B.prenom p1b_first_name
, P1B.name_zh p1b_name_zh
, P1B.birthday p1b_birthday
, P1B.sexe p1b_gender
, P1B.nat p1b_nat
, P1B.photo p1b_photo
, P1B.taille p1b_height
, P1B.poids p1b_weight
, R1B.rank p1b_rank
, R1B.liveRank p1b_rank_live
, P1B.pro_depuis p1b_turn_pro
, P2.id p2_id
, P2.nom p2_name
, P2.prenom p2_first_name
, P2.name_zh p2_name_zh
, P2.birthday p2_birthday
, P2.sexe p2_gender
, P2.nat p2_nat
, P2.photo p2_photo
, P2.taille p2_height
, P2.poids p2_weight
, R2.rank p2_rank
, R2.liveRank p2_rank_live
, P2.pro_depuis p2_turn_pro
, '?' p2_best_rank
, P2.prise p2_forehand
, P2.revers p2_backhand
, M.ts2 p2_seed
, P2B.id p2b_id
, P2B.nom p2b_name
, P2B.prenom p2b_first_name
, P2B.name_zh p2b_name_zh
, P2B.birthday p2b_birthday
, P2B.sexe p2b_gender
, P2B.nat p2b_nat
, P2B.photo p2b_photo
, P2B.taille p2b_height
, P2B.poids p2b_weight
, R2B.rank p2b_rank
, R2B.liveRank p2b_rank_live
, P2B.pro_depuis p2b_turn_pro
, T.id tournament_id
, T.idt tournament_idt
, '?' rencontre_id
, N.name_fr tournament_name_fr
, N.name_en tournament_name_en
, N.name_zh tournament_name_zh
, N.name_de tournament_name_de
, N.name_es tournament_name_es
, T.ville tournament_city
, T.stade tournament_stadium
, T.surface tournament_surface
, T.surface_photo tournament_surface_photo
, T.surface_color tournament_surface_color
, T.monnaie tournament_currency
, T.prix tournament_prize_money
, SCO.nom_fr tournament_country
, T.logo tournament_logo
, T.debut tournament_start
, T.fin tournament_end
, T.nbj tournament_nbPlayer
, T.genre tournament_genre
, T.category tournament_category
, T.type tournament_type
, T.ids tournament_site
, T.year tournament_year
, T.importance tournament_importance
, '' team1
, '' team2
, T.importance
, T.background tournament_background
, SC.fuseau_horaire
, IF(ISNULL(LS.status) || M.status = 2 || M.status = 3 || M.status = 4, M.status, LS.status) match_status
, LS.serve
, S.time s_time_start
, S.court
, S.date_loc
, S.type s_type
, S.ordre s_order
, C.nom court_name
, C.ordre court_order
FROM
tournois_matchs M
INNER JOIN joueurs P1 on P1.id = M.j1
LEFT OUTER JOIN `joueurs` P1B on P1B.id = M.j1_bis
INNER JOIN joueurs P2 on P2.id = M.j2
LEFT OUTER JOIN `joueurs` P2B on P2B.id = M.j2_bis
LEFT JOIN tennis_rankings R1 on R1.player = P1.id AND R1.id = IF(P1.sexe = 1, 'wta', 'atp')
LEFT JOIN tennis_rankings R1B on R1B.player = P1B.id AND R1B.id = IF(P1B.sexe = 1, 'wta', 'atp')
LEFT JOIN tennis_rankings R2 on R2.player = P2.id AND R2.id = IF(P2.sexe = 1, 'wta', 'atp')
LEFT JOIN tennis_rankings R2B on R2B.player = P2B.id AND R2B.id = IF(P2B.sexe = 1, 'wta', 'atp')
INNER JOIN tournois T on T.id = M.idt
INNER JOIN tournois_name N on N.id = T.id && N.cup = 0
LEFT OUTER JOIN lieux_sites SL on T.ids = SL.id
LEFT OUTER JOIN lieux_villes SC on SL.idv = SC.id
LEFT OUTER JOIN lieux_pays SCO on SCO.code = SC.pays
LEFT OUTER JOIN `livescores_new`.`matchs` LS on LS.tt_match_id = M.id
LEFT OUTER JOIN tournois_programmes S on S.idm = M.id
LEFT OUTER JOIN lieux_courts C on C.ids = S.ids && C.ordre = S.court
WHERE
M.id = '9431643'
&& M.type_tournoi_add = 0
&& (S.statut = 0 || S.statut = 4 || S.statut = 2 || ISNULL(S.statut))
UNION
SELECT
M.*
, M.time_start time_start
, M.time time_end
, M.duration_pause
, M.type_match_add type_match
, M.type_tournoi_add type_tournament
, CR.niveau level
, M.qualif
, M.idw winner_id
, P1.id p1_id
, P1.nom p1_name
, P1.prenom p1_first_name
, P1.name_zh p1_name_zh
, P1.birthday p1_birthday
, P1.sexe p1_gender
, P1.nat p1_nat
, P1.photo p1_photo
, P1.taille p1_height
, P1.poids p1_weight
, R1.rank p1_rank
, R1.liveRank p1_rank_live
, P1.pro_depuis p1_turn_pro
, '?' p1_best_rank
, P1.prise p1_forehand
, P1.revers p1_backhand
, M.ts1 p1_seed
, P1B.id p1b_id
, P1B.nom p1b_name
, P1B.prenom p1b_first_name
, P1B.name_zh p1b_name_zh
, P1B.birthday p1b_birthday
, P1B.sexe p1b_gender
, P1B.nat p1b_nat
, P1B.photo p1b_photo
, P1B.taille p1b_height
, P1B.poids p1b_weight
, R1B.rank p1b_rank
, R1B.liveRank p1b_rank_live
, P1B.pro_depuis p1b_turn_pro
, P2.id p2_id
, P2.nom p2_name
, P2.prenom p2_first_name
, P2.name_zh p2_name_zh
, P2.birthday p2_birthday
, P2.sexe p2_gender
, P2.nat p2_nat
, P2.photo p2_photo
, P2.taille p2_height
, P2.poids p2_weight
, R2.rank p2_rank
, R2.liveRank p2_rank_live
, P2.pro_depuis p2_turn_pro
, '?' p2_best_rank
, P2.prise p2_forehand
, P2.revers p2_backhand
, M.ts2 p2_seed
, P2B.id p2b_id
, P2B.nom p2b_name
, P2B.prenom p2b_first_name
, P2B.name_zh p2b_name_zh
, P2B.birthday p2b_birthday
, P2B.sexe p2b_gender
, P2B.nat p2b_nat
, P2B.photo p2b_photo
, P2B.taille p2b_height
, P2B.poids p2b_weight
, R2B.rank p2b_rank
, R2B.liveRank p2b_rank_live
, P2B.pro_depuis p2b_turn_pro
, C.id tournament_id
, C.parent tournament_idt
, CR.id rencontre_id
, N.name_fr tournament_name_fr
, N.name_en tournament_name_en
, N.name_zh tournament_name_zh
, N.name_de tournament_name_de
, N.name_es tournament_name_es
, CONCAT(CR.equipe_domicile, '|', CR.equipe_exterieur) tournament_city
, '' tournament_stadium
, CR.surface tournament_surface
, '' tournament_surface_photo
, '0' tournament_surface_color
, '' tournament_currency
, '' tournament_prize_money
, SCO.nom_fr tournament_country
, '' tournament_logo
, CR.date_d tournament_start
, '' tournament_end
, C.nbj tournament_nbPlayer
, '' tournament_genre
, '' tournament_category
, '' tournament_type
, CR.lieu tournament_site
, '' tournament_year
, 65 tournament_importance
, IF(T1.nom_fr, T1.nom_fr, CR.equipe_domicile) team1
, IF(T2.nom_fr, T1.nom_fr, CR.equipe_exterieur) team2
, 65 importance
, '' tournament_background
, SC.fuseau_horaire
, IF(ISNULL(LS.status) || M.status = 2 || M.status = 3 || M.status = 4, M.status, LS.status) match_status
, LS.serve
, S.time s_time_start
, S.court
, S.date_loc
, S.type s_type
, S.ordre s_order
, CT.nom court_name
, CT.ordre court_order
FROM
tournois_matchs M
INNER JOIN joueurs P1 on P1.id = M.j1
LEFT OUTER JOIN `joueurs` P1B on P1B.id = M.j1_bis
INNER JOIN joueurs P2 on P2.id = M.j2
LEFT OUTER JOIN `joueurs` P2B on P2B.id = M.j2_bis
LEFT JOIN tennis_rankings R1 on R1.player = P1.id AND R1.id = IF(P1.sexe = 1, 'wta', 'atp')
LEFT JOIN tennis_rankings R1B on R1B.player = P1B.id AND R1B.id = IF(P1B.sexe = 1, 'wta', 'atp')
LEFT JOIN tennis_rankings R2 on R2.player = P2.id AND R2.id = IF(P2.sexe = 1, 'wta', 'atp')
LEFT JOIN tennis_rankings R2B on R2B.player = P2B.id AND R2B.id = IF(P2B.sexe = 1, 'wta', 'atp')
LEFT OUTER JOIN `livescores_new`.`matchs` LS ON (LS.tt_match_id = M.id)
LEFT OUTER JOIN tournois_programmes S on S.idm = M.id
LEFT OUTER JOIN lieux_courts CT on (CT.ids = S.ids && CT.ordre = S.court)
INNER JOIN `coupes_rencontres` CR on CR.id = M.idt
INNER JOIN `coupes` C on C.id = CR.coupe_id
INNER JOIN tournois_name N on N.id = C.id
LEFT JOIN lieux_sites SL on SL.id = CR.lieu
LEFT JOIN lieux_villes SC on SC.id = SL.idv
LEFT JOIN lieux_pays SCO on SCO.code = SC.pays
LEFT JOIN `lieux_pays` T1 ON (T1.code = CR.equipe_domicile)
LEFT JOIN `lieux_pays` T2 ON (T2.code = CR.equipe_exterieur)
WHERE
M.id = '9431643'
&& M.type_tournoi_add = 1
&& (S.statut = 0 || S.statut = 4 || S.statut = 2 || ISNULL(S.statut))
UNION
SELECT
M.*
, M.time_start time_start
, M.time time_end
, M.duration_pause
, M.type_match_add type_match
, M.type_tournoi_add type_tournament
, '' level
, M.qualif
, M.idw winner_id
, P1.id p1_id
, P1.nom p1_name
, P1.prenom p1_first_name
, P1.name_zh p1_name_zh
, P1.birthday p1_birthday
, P1.sexe p1_gender
, P1.nat p1_nat
, P1.photo p1_photo
, P1.taille p1_height
, P1.poids p1_weight
, R1.rank p1_rank
, R1.liveRank p1_rank_live
, P1.pro_depuis p1_turn_pro
, '?' p1_best_rank
, P1.prise p1_forehand
, P1.revers p1_backhand
, M.ts1 p1_seed
, P1B.id p1b_id
, P1B.nom p1b_name
, P1B.prenom p1b_first_name
, P1B.name_zh p1b_name_zh
, P1B.birthday p1b_birthday
, P1B.sexe p1b_gender
, P1B.nat p1b_nat
, P1B.photo p1b_photo
, P1B.taille p1b_height
, P1B.poids p1b_weight
, R1B.rank p1b_rank
, R1B.liveRank p1b_rank_live
, P1B.pro_depuis p1b_turn_pro
, P2.id p2_id
, P2.nom p2_name
, P2.prenom p2_first_name
, P2.name_zh p2_name_zh
, P2.birthday p2_birthday
, P2.sexe p2_gender
, P2.nat p2_nat
, P2.photo p2_photo
, P2.taille p2_height
, P2.poids p2_weight
, R2.rank p2_rank
, R2.liveRank p2_rank_live
, P2.pro_depuis p2_turn_pro
, '?' p2_best_rank
, P2.prise p2_forehand
, P2.revers p2_backhand
, M.ts2 p2_seed
, P2B.id p2b_id
, P2B.nom p2b_name
, P2B.prenom p2b_first_name
, P2B.name_zh p2b_name_zh
, P2B.birthday p2b_birthday
, P2B.sexe p2b_gender
, P2B.nat p2b_nat
, P2B.photo p2b_photo
, P2B.taille p2b_height
, P2B.poids p2b_weight
, R2B.rank p2b_rank
, R2B.liveRank p2b_rank_live
, P2B.pro_depuis p2b_turn_pro
, L.id tournament_id
, 0 tournament_idt
, LR.id rencontre_id
, N.name_fr tournament_name_fr
, N.name_en tournament_name_en
, N.name_zh tournament_name_zh
, N.name_de tournament_name_de
, N.name_es tournament_name_es
, SC.nom tournament_city
, '' tournament_stadium
, '3' tournament_surface
, '' tournament_surface_photo
, '0' tournament_surface_color
, '' tournament_currency
, '' tournament_prize_money
, SCO.nom_fr tournament_country
, '' tournament_logo
, L.time_start tournament_start
, '' tournament_end
, '' tournament_nbPlayer
, '' tournament_genre
, '' tournament_category
, '' tournament_type
, LR.site tournament_site
, L.year tournament_year
, 0 tournament_importance
, '' team1
, '' team2
, 3 importance
, '' tournament_background
, SC.fuseau_horaire
, IF(ISNULL(LS.status) || M.status = 2 || M.status = 3 || M.status = 4, M.status, LS.status) match_status
, LS.serve
, S.time s_time_start
, S.court
, S.date_loc
, S.type s_type
, S.ordre s_order
, CT.nom court_name
, CT.ordre court_order
FROM
tournois_matchs M
JOIN joueurs P1 on P1.id = M.j1
LEFT JOIN `joueurs` P1B on P1B.id = M.j1_bis
JOIN joueurs P2 on P2.id = M.j2
LEFT JOIN `joueurs` P2B on P2B.id = M.j2_bis
LEFT JOIN tennis_rankings R1 on R1.player = P1.id AND R1.id = IF(P1.sexe = 1, 'wta', 'atp')
LEFT JOIN tennis_rankings R1B on R1B.player = P1B.id AND R1B.id = IF(P1B.sexe = 1, 'wta', 'atp')
LEFT JOIN tennis_rankings R2 on R2.player = P2.id AND R2.id = IF(P2.sexe = 1, 'wta', 'atp')
LEFT JOIN tennis_rankings R2B on R2B.player = P2B.id AND R2B.id = IF(P2B.sexe = 1, 'wta', 'atp')
LEFT JOIN `livescores_new`.`matchs` LS ON (LS.tt_match_id = M.id)
LEFT JOIN tournois_programmes S on S.idm = M.id
LEFT JOIN lieux_courts CT on (CT.ids = S.ids && CT.ordre = S.court)
JOIN `leagues_rounds` LR on LR.id = M.league_round
JOIN `leagues` L on L.id = LR.league
JOIN tournois_name N on N.league = L.id
LEFT JOIN lieux_sites SL on SL.id = LR.site
LEFT JOIN lieux_villes SC on SC.id = SL.idv
LEFT JOIN lieux_pays SCO on SCO.code = SC.pays
WHERE
M.id = '9431643'
&& M.type_tournoi_add = 2
&& (S.statut = 0 || S.statut = 4 || S.statut = 2 || ISNULL(S.statut))
LIMIT 1
무세티와 오제-알리아심이 주목받다: 브뤼셀 ATP 250 대회가 기대된다
벨기에 수도는 테니스의 리듬에 맞춰 흥분할 준비를 하고 있으며, 브뤼셀에서 ATP 250 대회의 시작을 알리고 있다. 로렌조 무세티와 펠릭스 오제-알리아심이 주연을 맡아 이번 대회는 유망하다. 하지만, 프랑스 측에서는 아르튀르 피스의 부재가 주목할 만하다.
10월 12일부터 19일까지는 ATP 250 브뤼셀 대회의 첫 번째 에디션이 열릴 예정이며, 이는 ...
신시내티에서 또 다시 비로 인한 경기 중단
며칠간의 극심한 더위 끝에, 어제부터 신시내티에는 비가 내리기 시작했습니다.
어제 일부 경기가 완료되지 못하면서 이미 오늘의 경기 일정은 조정이 필요한 상황이었습니다.
그러나 오하이오 주에는 급격히 비가 내리기 시작해, 시너 대 마나리노(6-4, 1-2), 셸턴 대 바우티스타 아구트(7-6, 1-2), 타우손 대 쿠데르메토바(6-3, 6-7, 3-5) ...
신시내티에서 비로 인해 저녁 경기 일정이 수요일로 연기됐다.
화요일, 신시내티에서는 아침부터 비가 내리기 시작했다. 진행 중이던 경기들은 몇 분간 중단됐다가 다시 정상으로 돌아왔다.
하지만 낮 동안의 지연은 오하이오에서의 나머지 일정에 영향을 미쳤다. 실제로 저녁에 예정됐던 네 경기는 기상 악화로 인해 끝까지 진행되지 못하거나 아예 시작조차 하지 못했다.
두 경기가 중단됐다: 체베레프-나카시마(6-4, 5-4...
뮐러, 로이에, 코리치: 8월 8일 금요일 신시내티 경기 일정
이번 금요일, 신시내티 마스터스 1000의 두 번째 경기 날이 펼쳐집니다. 첫 라운드를 위한 많은 경기들이 앞으로 몇 시간 내에 열릴 예정입니다. 센터 코트에서는 두 번째 경기로, 2022년 오하이오에서 우승한 보르나 코리치가 예선을 통과한 에밀리오 나바와 첫 경기를 치룰 것입니다.
이어서 알렉상드르 뮐러가 젠슨 브룩스비와 맞붙을 예정입니다. 저녁 세션에...
바우티스타 아구트, 토론토 마스터스 1000 기권... 가스통 본선 진출
다음 주 예정된 토론토 마스터스 1000의 기권 선수들이 계속해서 늘어나고 있다. 최근에는 로베르토 바우티스타 아구트(스페인, 세계 랭킹 53위, 37세)가 기권을 발표했다. 그는 키츠뷔헐 대회에서 티아고 세이보스 와일드에게 7-5, 7-5로 패배한 후 캐나다 대회 참가를 포기했다.
그의 빈 자리는 휴고 가스통이 대체하게 되었으며, 가스통은 예선을 거...