sqlite将两个或多个行合并为同一个表中的一行

时间:2014-02-27 19:43:33

标签: sqlite

问候语。我的问题是:我在表格中有一些值,如

SELECT * FROM items WHERE owner="Mark" AND object="apple";
+-------+-------+-------+-------+  
|  id   | owner | object|amount |  
+-------+-------+-------+-------+  
|  12   | Mark  | apple |   16  |  
+-------+-------+-------+-------+  
|  16   | Mark  | apple |    3  |  
+-------+-------+-------+-------+  
|  34   | Mark  | apple |    8  |  
+-------+-------+-------+-------+  
|  34   | Mark  | apple |    0  |  
+-------+-------+-------+-------+  

并且任务是抓住第一个,总结给所有其他金额,然后删除其余的所以最终所有将像

+-------+-------+-------+-------+  
|  id   | owner | object|amount |  
+-------+-------+-------+-------+  
|  12   | Mark  | apple |   27  |  
+-------+-------+-------+-------+  

0 个答案:

没有答案