• Составить SQL запрос (один ко многим)

    0neS
    @0neS
    Используйте LEFT JOIN и алиасы:
    SELECT event.title, event.url, event.date, type.name as type_name, tournament.name as tournament_name, team1.name AS team1_name, team2.name AS team2_name
    FROM events event
    LEFT JOIN types type ON event.type_id = type.id
    LEFT JOIN tournaments tournament ON event.tournament_id = tournament.id
    LEFT JOIN members team1 ON event.member_1_id = team1.id
    LEFT JOIN members team2 ON event.member_2_id = team2.id
    ORDER BY event.date
    Ответ написан
    Комментировать