Good morning friends,
I hope you can help me, I'm trying to make a query that depends on the category and if the sum of one column results in 1 the total is added.
Any contribution can help me:)
example
|---------------------|------------------|------------------|------------------|
| categoria | categoria 2 | valor | Total |
|---------------------|------------------|------------------|------------------|
| a | a | 0.2 | 20 |
|---------------------|------------------|------------------|------------------|
| a | a | 0.2 | 42 |
|---------------------|------------------|------------------|------------------|
| a | a | 0.2 | 46 |
|---------------------|------------------|------------------|------------------|
| a | a | 0.2 | 23 |
|---------------------|------------------|------------------|------------------|
| a | a | 0.2 | 6 |
|---------------------|------------------|------------------|------------------|
| a | a | 0.7 | 30 |
|---------------------|------------------|------------------|------------------|
| a | a | 0.3 | 30 |
|---------------------|------------------|------------------|------------------|
| b | c | 0.6 | 80 |
|---------------------|------------------|------------------|------------------|
| c | b | 0.4 | 54 |
|---------------------|------------------|------------------|------------------|
| c | b | 0.6 | 23 |
|---------------------|------------------|------------------|------------------|
How I want it to come out
|---------------------|------------------|------------------|------------------|
| categoria | categoria 2 | valor | Total |
|---------------------|------------------|------------------|------------------|
| a | a | 1 | 137 |
|---------------------|------------------|------------------|------------------|
| a | a | 1 | 60 |
|---------------------|------------------|------------------|------------------|
| c | b | 1 | 77 |
|---------------------|------------------|------------------|------------------|
My main problem is that I want all the possible lines of the categories with a maximum value of 1 to go out
Those who do not complete 1 in the value does not matter if they appear.
Thank you very much:)