1

This question already has an answer here:

at first, sorry for my English. I'm using Google translator.

I have a .shp file with attribute table. Like this...

-- A --     -- B --      -- C --
  QString     Double        Double        Data type
30STH400500     1            30
30STH400500     1            30
30STH400500     1            30
30STH400500     1            30
...........    ...          ...
...........    ...          ...

30STH400500     2            10
30STH400500     2            10
30STH400500     2            10
30STH400500     2            10
...........    ...          ....
...........    ...          ....

30STH400500     3            20
30STH400500     3            20
30STH400500     3            20
30STH400500     3            20
...........    ...          ....
...........    ...          ....

30STH450450     1            10

...............................
...............................

And now, I want a new field, "D" (Data type, double) like this:

(CASE WHEN "A"='30STH400500' AND "B"= 1 THEN "C" END)+(CASE WHEN "A"='30STH400500' AND "B"= 2 THEN "C" END)+(CASE WHEN "A"='30STH400500' AND "B"= 3 THEN "C" END).

So, I do it in Field Calculator, but I get NULL value.

I like that for A=30STH400500, D=60, sum value C.

I don't Know if I have explained it very well.

marked as duplicate by Paul, MappaGnosis, whuber Oct 30 '14 at 14:25

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.