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 = '9442201'
&& 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 = '9442201'
&& 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 = '9442201'
&& 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 = '9442216'
&& 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 = '9442216'
&& 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 = '9442216'
&& 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 = '9442212'
&& 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 = '9442212'
&& 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 = '9442212'
&& 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 = '9442211'
&& 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 = '9442211'
&& 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 = '9442211'
&& 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 = '9442494'
&& 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 = '9442494'
&& 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 = '9442494'
&& 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 = '9442493'
&& 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 = '9442493'
&& 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 = '9442493'
&& 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 = '9442778'
&& 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 = '9442778'
&& 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 = '9442778'
&& 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 = '9442777'
&& 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 = '9442777'
&& 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 = '9442777'
&& 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 = '9441044'
&& 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 = '9441044'
&& 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 = '9441044'
&& 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 = '9441048'
&& 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 = '9441048'
&& 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 = '9441048'
&& 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 = '9441049'
&& 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 = '9441049'
&& 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 = '9441049'
&& 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 = '9441050'
&& 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 = '9441050'
&& 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 = '9441050'
&& 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 = '9441051'
&& 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 = '9441051'
&& 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 = '9441051'
&& 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 = '9441055'
&& 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 = '9441055'
&& 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 = '9441055'
&& 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 = '9441057'
&& 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 = '9441057'
&& 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 = '9441057'
&& 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 = '9440451'
&& 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 = '9440451'
&& 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 = '9440451'
&& 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 = '9440683'
&& 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 = '9440683'
&& 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 = '9440683'
&& 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 = '9440799'
&& 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 = '9440799'
&& 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 = '9440799'
&& 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 = '9440351'
&& 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 = '9440351'
&& 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 = '9440351'
&& 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 = '9440352'
&& 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 = '9440352'
&& 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 = '9440352'
&& 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 = '9440367'
&& 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 = '9440367'
&& 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 = '9440367'
&& 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 = '9440363'
&& 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 = '9440363'
&& 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 = '9440363'
&& 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 = '9440365'
&& 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 = '9440365'
&& 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 = '9440365'
&& 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 = '9440136'
&& 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 = '9440136'
&& 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 = '9440136'
&& 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 = '9440137'
&& 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 = '9440137'
&& 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 = '9440137'
&& 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 = '9440138'
&& 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 = '9440138'
&& 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 = '9440138'
&& 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 = '9440141'
&& 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 = '9440141'
&& 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 = '9440141'
&& 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 = '9440142'
&& 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 = '9440142'
&& 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 = '9440142'
&& 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 = '9440146'
&& 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 = '9440146'
&& 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 = '9440146'
&& 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 = '9440149'
&& 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 = '9440149'
&& 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 = '9440149'
&& 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 = '9440151'
&& 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 = '9440151'
&& 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 = '9440151'
&& 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 = '9439844'
&& 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 = '9439844'
&& 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 = '9439844'
&& 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 = '9439782'
&& 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 = '9439782'
&& 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 = '9439782'
&& M.type_tournoi_add = 2
&& (S.statut = 0 || S.statut = 4 || S.statut = 2 || ISNULL(S.statut))
LIMIT 1
사발렌카, 아니시모바, 부아송… WTA 어워즈 후보에 오른 선수 전체 명단
WTA가 월요일 시즌 중 여러 부문에서 두드러진 활약을 펼친 선수들을 매년 선정하는 WTA 어워즈 후보 명단을 발표했다.
세계 1위 아리나 사발렌카, 그 뒤를 잇는 이가 스비아텍, 그리고 아만다 아니시모바, 엘레나 리바키나, 코코 고프, 매디슨 키스 등 총 6명의 선수가 올해의 선수 부문 후보에 올랐다.
가장 큰 향상을 보인 선수에게 수여되는 트로피는 ...
칸 오픈, 부아송과 무제티 등 참가자 공개
연말에 열리는 전통적인 엑시비션 토너먼트인 칸 오픈이 참가 선수 명단을 공개했습니다.
남자 부문에서는 로렌조 무제티, 벤자맹 봉지, 위고 가스통, 로렌조 소네고, 알레한드로 다비도비치 포키나가 참가가 확정되었습니다. 예선을 통과한 위르겐 브리앙도 이 명단에 이름을 올렸습니다.
여자 부문에서는 로이스 부아송과 클라라 타우손만 현재까지 확정되었습니다. 예선...
홍콩 WTA 250: 벤치치 연승, 페르난데스와 음보코 진출, 볼터 기권
10월 28일 화요일, 홍콩 토너먼트 1라운드가 마무리되었습니다.
이날 홍콩에서는 16강전이 종료되었습니다. 지난주 도쿄에서 우승한 1번 시드 벨린다 벤치치는 시즌 마무리를 앞두고 자신감을 쌓기 위해 새로운 토너먼트에서도 연속으로 출전했습니다.
세계 랭킹 11위인 그녀는 WTA 랭킹 111위인 알랙산드라 사스노비치와 맞섰습니다. 2년 만의 첫 맞대결에서...
오사카, 오사카에서 체면 유지: 일본 선수, 라멘스를 힘겹게 제치고 8강 진출
오사카 대회 1번 시드인 나오미 오사카가 대회 두 번째 경기에서 승리를 거두며 8강에 합류했습니다.
세계 랭킹 16위인 오사카는 WTA 250 오사카 대회에서 와카나 소노베(6-0, 6-4)를 상대로 거둔 개막전 승리를 이어가고자 했습니다. 홈그라운드인 이 대회 1번 시드인 일본 선수는 1라운드에서 에밀리아나 아랑고(6-1, 6-2)를 꺾은 수잔 라멘스와...
WTA 250 오사카 대회: 대진 추첨 발표, 나오미 오사카의 타이틀 향한 경로 확정
일본 오픈 대진 추첨이 오사카에서 흥미진진한 한 주를 예고했습니다.
ATP 투어의 아시아 시리즈가 막을 내린 반면, WTA 토너먼트는 아시아에서 계속됩니다. 일본 오픈의 14번째 대회가 오사카에서 열릴 예정입니다.
이 대회는 WTA 250 등급에 속합니다. 나오미 오사카가 대회 1번 시드로 이번 주 최고 우승 후보로 꼽힙니다. 그녀는 초청 선수인 소노베...
파올리니, 우한에서 기권승: 타우손 8강전에서 중도 포기
우한 WTA 1000 대회에서 이날의 주목할 만한 경기 중 하나는 자스민 파올리니와 클라라 타우손의 대결이었습니다. 두 선수는 전반적으로 매우 좋은 시즌을 보내고 있으며 중국에서의 8강 진출 자리를 놓고 경쟁했습니다.
이것은 작년 베이징 WTA 1000 대회 2라운드에서 이탈리아 선수의 역전승(1-6, 7-5, 6-4) 이후 두 선수 간의 단 두 번째 맞...