Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- SELECT
- max(IF(number=1, epParticipant.id, NULL)) as hparticipant_id,
- max(IF(number=2, epParticipant.id, NULL)) as vparticipant_id,
- max(IF(number=1, epParticipant.countryFK, NULL)) as hcountry_id,
- max(IF(number=2, epParticipant.countryFK, NULL)) as vcountry_id,
- max(IF(number=1, epParticipant.name, NULL)) as hparticipant_name,
- max(IF(number=2,epParticipant.name, NULL)) as vparticipant_name,
- max(IF(number=2,epResult.value, NULL)) as hresultat_value,
- max(IF(number=1,epResult.value, NULL)) as vresultat_value,
- prono.short_stage,
- epEvent.name AS event_name,
- sp.name as sport_name,
- epEventParti.eventFK as event_id,
- epEvent.status_type as status_type,
- epEvent.startdate,
- ts.id AS stage_id,
- sp.id as sport_id,
- COUNT(epEventParti.id) AS nb_participants,
- ts_fr.name as stage_name,
- pronoGold.resultat as resultatProno
- FROM prono_premium pronoGold
- JOIN ep_event epEvent ON epEvent.id = pronoGold.eventFK
- LEFT JOIN ep_event_participants as epEventParti ON epEventParti.eventFK = pronoGold.eventFK
- LEFT JOIN ep_result epResult ON epEventParti.id = epResult.event_participantsFK AND epResult.result_typeFK = 6
- LEFT JOIN ep_participant as epParticipant ON epParticipant.id = epEventParti.participantFK
- JOIN ep_tournament_stage AS ts ON epEvent.tournament_stageFK= ts.id
- JOIN ep_tournament AS t ON ts.tournamentFK=t.id
- JOIN ep_tournament_template AS tt ON t.tournament_templateFK=tt.id
- JOIN ep_sport as sp ON sp.id=tt.sportFK
- LEFT JOIN ep_language ts_fr ON ts.id = ts_fr.objectFK AND ts_fr.object= "tournament_stage" AND ts_fr.language_typeFK=29
- INNER JOIN prono_event as prono ON epEventParti.eventFK=prono.eventFK
- WHERE ep_event_participants.eventFK=ev.id), "") AS allparticipants_name
- WHERE epEvent.status_type = "finished"
- group by event_id
- ORDER BY event_id desc
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement