If it's been asked before then my search function is cursed.
select postkode, gemeente, count(postkode) as total
from leveradressen
where land=1
group by postkode
order by postkode asc
postkode is a zipcode gemeente is the town name
i try to run this but i get
Msg 8120, Level 16, State 1, Line 4
Column 'leveradressen.Gemeente' is invalid in the select list because it is not contained in either an aggregate function or the GROUP BY clause.
... no idea how to make it work. I know WHY he does it. but this is an assignment to see if i can keep this job and i'm utterly failing at it.
what's happening is he thinks that there's too many place names to pick from. but every place name matches every zipcode. there are never any deviations. 2000 will always be antwerpen, for example.
and no i can't fix it by adding a 'group by' because that's in there and i can't use aggregate functions because both postkode and plaatsnaam are both nvarchar.
i'm out of ideas.