David Rumpf
David Rumpf

Reputation: 57

SQL, Count statement

select count(characterid) as num , schoolhouseid
from student natural join Character

Pretty much a beginner in SQL, trying to figure out why the count statement crashes the syntax. it works without schoolhouseid and also without the count but together it crashes

Upvotes: 0

Views: 48

Answers (1)

eshirvana
eshirvana

Reputation: 24603

well it depends what's your desired output, but it looks like you are trying to do this :

select count(*) as num , schoolhouseid
from student
group by schoolhouseid

which gives you number of rows you have in each schoolhouse

Upvotes: 1

Related Questions