Hello folks,

i need help for a query..

I have 2 tables ..

user table: useridid city

and another table, the reward table :
userid reward points ,

I want to sum up the points according to the city and list them..

Any ideas ? I am loooooost ..

Thank you for any advice.

the result i am looking for :

CITY REWARDS
New York 5000
Chicago 2000
Washington 500

select city, sum(rewards) from user, rewards where city.userid=rewards.userid group by city;

They call it a join. Read about it, you need it everywhere in databases.

works great. thank you for your help

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.