I have a table containing the following line:

I’d like to create a view that displays the following result (without changing my original table) :

For each line having the same id,day,month and year I’d like to leave a single line with the cost and count and insert 0 in the others.
Here is a portable approach not requiring
PARTITION. I have assumed you will not have the samedatetimeINvalue for more than one row in a group: