mysql - Get two registers from a MxN resulting table -


i have following tables on database , i'd id, date_time, tb_rate_id tb_match , name of teams present on match given championship provided me.

tb_match(id, flag_active, flag_canceled, flag_finished, date_time, home_goals, away_goals, tb_rate_id, tb_championship_id);

tb_match_team(tb_match_id, tb_team_id, order);

tb_team(id, team_name, tb_champ_id);

tb_rate(id, casa, empate, fora, gol_meio, mais_2gm, menos_3gm, ambas_marcam, casa_empate, fora_empate, casa_marca, fora_marca, casa_ou_fora, casavence_foramarca, foravence_casamarca, casavence_zero, foravence_zero)

tb_championship(id, nome_camp, tb_pais_id).

i able these informations query:

select team.team_name , matchx.id, matchx.data_hora, matchx.tb_rate_id

from tb_match matchx, tb_team team, tb_match_team matchteam

where (matchx.id = tb_match_id && team.id = tb_team_id) , (matchx.flag_active = 1 , matchx.flag_canceled <> 1 , matchx.flag_finished <> 1);

the thing returns me this:

team_name | id | date_time | tb_rate_id
flamengo | 4 | 2016-09-03 14:00:00 | 4
acreano | 4 | 2016-09-03 14:00:00 | 4
lok. zagreb| 5 | 2016-09-03 14:00:00 | 4
solin| 5 | 2016-09-03 14:00:00 | 4

i want both of team names belong same match on same row. someting home_team , away_team. can me this? i'm beginner databases i'm learning things join , stuff didn't mastered yet. thaks in advance.


Comments

Popular posts from this blog

asynchronous - C# WinSCP .NET assembly: How to upload multiple files asynchronously -

aws api gateway - SerializationException in posting new Records via Dynamodb Proxy Service in API -

asp.net - Problems sending emails from forum -