sql - SQLite: How to return count of zero from left join? -


i have 2 tables: players (id, name) , goals (id, player_id). want return list of players , number of goals have associated them, if have no goals associated them. have tried:

select player.name player_name,         count(goal.id) goals    player         left join goal         on player.id = goal.player_id  group player   order goals desc; 

but problem returns 1 player 0 goals, , can't figure out why. know it's group clause. there many players 0 goals.

you grouping entire table, instead of single field in player table unique (such player.name perhaps).


Comments

Popular posts from this blog

asynchronous - C# WinSCP .NET assembly: How to upload multiple files asynchronously -

aws api gateway - SerializationException in posting new Records via Dynamodb Proxy Service in API -

asp.net - Problems sending emails from forum -