hi,
I have written code in T-Sql used code converter for PostgreSQL, got below code but it is giving complier error. I have no clue in PostgreSQL so any pointer will be of great help.
------------------------------------------------------------------------------------------------------------------------------
I have written code in T-Sql used code converter for PostgreSQL, got below code but it is giving complier error. I have no clue in PostgreSQL so any pointer will be of great help.
------------------------------------------------------------------------------------------------------------------------------
Code:
select t.team_id, t.team_name,COALESCE(SUM(num_points),0) num_points from
(select team_id, [B]host_team, 3 into team_name, num_points [/B] [I]-----syntax error at or near ","
-----LINE 3: (select team_id, host_team, 3 into team_name, num_points[/I]
from matches m
inner join teams t on m.host_team = t.team_id
where host_goals > guest_goals
Union All
select team_id, guest_team, 3 into team_name, num_points
from matches m
inner join teams t on m.guest_team = t.team_id
where guest_goals > host_goals
Union All
select team_id, guest_team, 1 into team_name, num_points
from matches m
inner join teams t on m.guest_team = t.team_id
where guest_goals = host_goals
Union All
select team_id, host_team, 1 into team_name, num_points
from matches m
inner join teams t on m.host_team = t.team_id
where guest_goals = host_goals)
r
right outer join teams t on r.team_id = t.team_id
group by t.team_id, t.team_name
order by 1
Comment