megetron
March 9th, 2005, 07:35 AM
Hi all,
I have a query, that I want to group by all the items in one field. but the group by query force me to group by, using all fields.
the query is this:
SELECT team.leauge,team.forum_name,team.forum_id,group_team.id,team.name,3*count( match.home_team_id) as points,sum(match.home_team_goals) as Goals_plus,sum(match.guest_team_goals) as Goals_minus from group_gvion,group_team,match_gvion, match,team where group_gvion.gvion_id=10 and group_gvion.group_id=group_team.id and (match.home_team_goals>match.guest_team_goals) and group_team.team_id=team.forum_id and (match.home_team_id=team.forum_id) and match_gvion.gvion_id=10 and match_gvion.match_id=match.id and match.level<=3 and match.status=1
group by team.leauge,team.forum_name, team.forum_id,group_team.id,team.name
UNION SELECT team.leauge,team.forum_name, team.forum_id,group_team.id,team.name,3*count(match.guest_team_id) ,sum(match.guest_team_goals),sum(match.home_team_goals) from group_gvion,group_team,match_gvion,match,team where group_gvion.gvion_id=10 and group_gvion.group_id=group_team.id and (match.home_team_goals<match.guest_team_goals) and group_team.team_id=team.forum_id and (match.guest_team_id=team.forum_id) and match.level<=3 and match_gvion.gvion_id=10 and match_gvion.match_id=match.id and match.status=1
group by team.leauge,team.forum_name, team.forum_id,group_team.id,team.name
is there any way group by only one field?
I have a query, that I want to group by all the items in one field. but the group by query force me to group by, using all fields.
the query is this:
SELECT team.leauge,team.forum_name,team.forum_id,group_team.id,team.name,3*count( match.home_team_id) as points,sum(match.home_team_goals) as Goals_plus,sum(match.guest_team_goals) as Goals_minus from group_gvion,group_team,match_gvion, match,team where group_gvion.gvion_id=10 and group_gvion.group_id=group_team.id and (match.home_team_goals>match.guest_team_goals) and group_team.team_id=team.forum_id and (match.home_team_id=team.forum_id) and match_gvion.gvion_id=10 and match_gvion.match_id=match.id and match.level<=3 and match.status=1
group by team.leauge,team.forum_name, team.forum_id,group_team.id,team.name
UNION SELECT team.leauge,team.forum_name, team.forum_id,group_team.id,team.name,3*count(match.guest_team_id) ,sum(match.guest_team_goals),sum(match.home_team_goals) from group_gvion,group_team,match_gvion,match,team where group_gvion.gvion_id=10 and group_gvion.group_id=group_team.id and (match.home_team_goals<match.guest_team_goals) and group_team.team_id=team.forum_id and (match.guest_team_id=team.forum_id) and match.level<=3 and match_gvion.gvion_id=10 and match_gvion.match_id=match.id and match.status=1
group by team.leauge,team.forum_name, team.forum_id,group_team.id,team.name
is there any way group by only one field?