Mr Chris Posted November 3, 2007 Share Posted November 3, 2007 Hi All, I have a query to output goalscorers in a table, and it works great. I basically output all scorers in a table: SELECT player_stats.player_id as player, players.player_name, players.position, SUM( player_stats.goals ) as total_goals FROM player_stats LEFT JOIN players ON players.player_id = player_stats.player_id AND player_stats.goals !='' GROUP BY players.player_id ORDER BY total_goals DESC But in the results produced there is one value named NULL so Iwant it to ignore that value, but I can't seem to do it. Any help please? SELECT player_stats.player_id as player, players.player_name, players.position, SUM( player_stats.goals ) as total_goals FROM player_stats LEFT JOIN players ON players.player_id = player_stats.player_id AND player_stats.goals !='' AND (players.player_name!='NULL') GROUP BY players.player_id ORDER BY total_goals DESC Thanks Chris PS: I've also tried NUll without the '' Quote Link to comment Share on other sites More sharing options...
ignace Posted November 3, 2007 Share Posted November 3, 2007 don't know if this is going to help you, but did you already tried (players.player_name IS NOT NULL)? Quote Link to comment Share on other sites More sharing options...
Mr Chris Posted November 3, 2007 Author Share Posted November 3, 2007 That's got it thanks! 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.