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? Link to comment https://forums.phpfreaks.com/topic/32809-solved-how-to-mix-group-colums-with-no-groups-colum/ 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] Link to comment https://forums.phpfreaks.com/topic/32809-solved-how-to-mix-group-colums-with-no-groups-colum/#findComment-152828 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.