mysqldump - mysql get the columns sum and also get the distinct values at a time -


i have data base this

id   project_id    client_id    price  1       1           1               200 2       2           1               123 3       2           1               100 4       1           1               87 5       1           1               143 6       1           1               100 7       3           3               123 8       3           3               99   9       4           3               86 10      4           3               43 11      4           3               145 12      4           3               155 

now here want sum price columns same client_id. made query this

select  `project_id`, sum(`price`) `table-name` group `client_id` 

this 1 doing sum price getting 2 project_id in result. want result should distinct project client id , price summed group clients. can tell me how this? , suggestions appreciable. thanks

you should not have "bare" column in group by query not in group by statement.

if want list of projects, can them in list this:

select client_id, group_concat(project_id), sum(price) table-name group client_id; 

Comments

Popular posts from this blog

Payment information shows nothing in one page checkout page magento -

tcpdump - How to check if server received packet (acknowledged) -