我必須進行選擇,被聯合在一個簡單的查詢...MySQL的:SUM 2頁聯合在一起的表(4×SUM在一個結果)
SELECT description_x, a, b, c, d from table a WHERE person_id = 1 UNION SELECT description_y, e ,f ,g ,h from table b WHERE person_id = 1
... A,B,C,d,E,F ,g,h都是整數。我怎樣才能他們,結果會看起來像這樣...
row 1: description_x | a | b | c | d row 2: description_y | e | f | g | h row 3: summary | a+e | b+f | c+g | d+h
...好嗎?
非常感謝!
c似乎與c有任何關係似乎很奇怪。 – Strawberry