| Blog信息 |
|
blog名称:注册会计师(注会)练习软件 日志总数:398 评论数量:116 留言数量:27 访问次数:3279143 建立时间:2005年6月6日 |

| |
|
[delpih编程]sql的合并查询一例 软件技术
吕向阳 发表于 2009/6/2 20:33:25 |
| 表customer1 customerID value 1 1 2 1 3 2 4 3 表customer2 customerID value 1 5 2 5 两个表合并(然后将value字段相加) 从网上看到的一个比较好的查询案例要求结果: 表customer customerID value 1 6 2 6 3 2 4 3 求sql语句 ========以下正解select customerID,sum(value) as value (select customerID , value from customer1 union all select customerID , value from customer2) as t group by customerID |
|
|