Ich habe eine Tabelle namens calcu
SQL Row weise Gesamtwert
id date name s1 s2 s3 s4 min_value
1 02/10/2017 dicky 7 4 8 9 4
2 02/10/2017 acton 12 15 17 19 15
3 02/10/2017 adney 28 13 19 10 13
This is my table in SQL Fiddle
I row wise total value
brauchen. I bedeutet in einer neuen Spalte total
wird es (s1 + s2 + s3 + s4) dh (7 + 4 + 8 + 9) = 28 where id=1
, (12 + 15 + 17 + 19) = 63 where id=2
, (28 + 13 + 19 + 10) = 70 where id=3
.
Ergebnis wird wie unten sein:
id date name s1 s2 s3 s4 min_value Total
1 02/10/2017 dicky 7 4 8 9 4 28
2 02/10/2017 acton 12 15 17 19 15 63
3 02/10/2017 adney 28 13 19 10 13 70
Es führt alle insgesamt 161 und 3 Zeilen 1 Zeile werden.
Wie schreibe ich SQL-Abfrage?
Hinweis: 's1 + s2 + s3 + d4'. –