i wanted to retrieve the sum of duplicate USD amount from below table with respect to date and ref_nr columns
uid date USD Ref_Nr
1 2018-04-11 1 7
1 2018-04-11 2 7
1 2018-04-11 3 8
1 2018-04-11 4 8
1 2018-04-11 6 6
1 2018-04-11 6 6
1 2018-04-10 3 7
1 2018-04-10 5 7
1 2018-04-10 2 8
1 2018-04-10 2 8
Here is my sql query and what i tried, but iam not getting proper output, please help me
SELECT uid
, date
, SUM(USD) AS USD
, Ref_Nr
FROM my_table
GROUP
BY `date`;
Here is expected output
uid date USD Ref_Nr
1 2018-04-11 3 7
1 2018-04-11 7 8
1 2018-04-11 12 6
1 2018-04-10 8 7
1 2018-04-10 4 8