Hi,
i am having big headaches in trying to find out how to perform a very very simple query.
having a table like this one:
well i want to get this output:
Which is the sum of the object1 and object2 column for each name
what I can get by now is:
SELECT DISTINCT name, object1, object2
which returns
I deduce here that it returns the rows that have at least one column which is different from other rows.
Whenever i try to use sum() it will return 1 row like this:
Here the sum() does not distinguish name it will sum up all the rows together and return the name of the user that has the most approximate object1 and object2 values to the resulting row
If you have any suggestion please let me know
Thank you very much
Bilibytes
i am having big headaches in trying to find out how to perform a very very simple query.
having a table like this one:
Code:
+--------------+----------+---------+ | name | object1 | object2 | +--------------+----------+---------+ | Mr Brown | 1 | 1 | | Mr Brown | 1 | 0 | | Mr Pullen | 1 | 0 | +--------------+----------+---------+
Code:
| Mr Brown | 2 | 1 | | Mr Pullen | 1 | 0 |
what I can get by now is:
SELECT DISTINCT name, object1, object2
which returns
Code:
| Mr Brown | 1 | 1 | | Mr Pullen | 1 | 0 | | Mr Brown | 1 | 0 |
Whenever i try to use sum() it will return 1 row like this:
Code:
| Mr Brown | 3 | 1 |
If you have any suggestion please let me know
Thank you very much
Bilibytes
Comment