Advertisement
Guest User

Untitled

a guest
Jan 19th, 2018
69
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.79 KB | None | 0 0
  1. SELECT
  2. max(IF(number=1, epParticipant.id, NULL)) as hparticipant_id,
  3. max(IF(number=2, epParticipant.id, NULL)) as vparticipant_id,
  4. max(IF(number=1, epParticipant.countryFK, NULL)) as hcountry_id,
  5. max(IF(number=2, epParticipant.countryFK, NULL)) as vcountry_id,
  6. max(IF(number=1, epParticipant.name, NULL)) as hparticipant_name,
  7. max(IF(number=2,epParticipant.name, NULL)) as vparticipant_name,
  8. max(IF(number=2,epResult.value, NULL)) as hresultat_value,
  9. max(IF(number=1,epResult.value, NULL)) as vresultat_value,
  10. prono.short_stage,
  11. epEvent.name AS event_name,
  12. sp.name as sport_name,
  13. epEventParti.eventFK as event_id,
  14. epEvent.status_type as status_type,
  15. epEvent.startdate,
  16. ts.id AS stage_id,
  17. sp.id as sport_id,
  18. COUNT(epEventParti.id) AS nb_participants,
  19. ts_fr.name as stage_name,
  20. pronoGold.resultat as resultatProno
  21. FROM prono_premium pronoGold
  22. JOIN ep_event epEvent ON epEvent.id = pronoGold.eventFK
  23. LEFT JOIN ep_event_participants as epEventParti ON epEventParti.eventFK = pronoGold.eventFK
  24. LEFT JOIN ep_result epResult ON epEventParti.id = epResult.event_participantsFK AND epResult.result_typeFK = 6
  25. LEFT JOIN ep_participant as epParticipant ON epParticipant.id = epEventParti.participantFK
  26. JOIN ep_tournament_stage AS ts ON epEvent.tournament_stageFK= ts.id
  27. JOIN ep_tournament AS t ON ts.tournamentFK=t.id
  28. JOIN ep_tournament_template AS tt ON t.tournament_templateFK=tt.id
  29. JOIN ep_sport as sp ON sp.id=tt.sportFK
  30. LEFT JOIN ep_language ts_fr ON ts.id = ts_fr.objectFK AND ts_fr.object= "tournament_stage" AND ts_fr.language_typeFK=29
  31. INNER JOIN prono_event as prono ON epEventParti.eventFK=prono.eventFK
  32. WHERE ep_event_participants.eventFK=ev.id), "") AS allparticipants_name
  33. WHERE epEvent.status_type = "finished"
  34. group by event_id
  35. ORDER BY event_id desc
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement