JJohnsenDK Posted January 4, 2007 Share Posted January 4, 2007 Heyhow do i mix group colums with no group colums?I have this:[code]$sql_actions = "SELECT SUM(a.goal) AS goals, COUNT(a.game_ID) as games, SUM(a.yellow_card) AS yellow, SUM(a.red_card) AS red, SUM(a.mins) AS mins, a.season_ID FROM actions AS a WHERE players_ID = ".$_GET['id']."";[/code]And get this error:[i]Mixing of GROUP columns (MIN(),MAX(),COUNT(),...) with no GROUP columns is illegal if there is no GROUP BY clause[/i]I tried GROUP BY 1 but gets this error:[i]Can't group on 'goals'[/i]Anyone who can figure this out? Quote Link to comment Share on other sites More sharing options...
taith Posted January 4, 2007 Share Posted January 4, 2007 you had "AS a " in the wrong spot...[code]$sql_actions = "SELECT SUM(a.goal) AS goals, COUNT(a.game_ID) as games, SUM(a.yellow_card) AS yellow, SUM(a.red_card) AS red, SUM(a.mins) AS mins, a.season_ID AS a FROM actions WHERE `players_ID`='$_GET[id]';[/code] Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.