Hi!

I have this table:

id table #people
1 ...1 .........3
2 ...1 .........5
3 ...4 .........2
4 ...3 .........5
5 ...1......... 2

i want to obtain the sum of people sitting per table.

hope you can help me...

So you would just need to "group by" table and use another aggregate function to sum them up. I bet you can find that function pretty easily.

SELECT table, sum(people)
FROM Tables
GROUP BY table

All aggregate functions (sum, max, min, avg, etc) must include a GROUP BY including all columns up-to the aggregate.

If this is a school assignment, I suggest you crack the books and spend time in the lab.

thank you all...
I was doing something really stupid.

:)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.