Jump to content

[SOLVED] Problem with Null values


Mr Chris

Recommended Posts

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 ''

Link to comment
https://forums.phpfreaks.com/topic/75894-solved-problem-with-null-values/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.