行合并的问题,求解
时间:2011-12-15
来源:互联网
假如有一张这样的表
orderId orderSummoney invoiceId invoiceDate invoiceMoney payId paydate payMoney
001 10000 FP001 2011-11-11 2000 NULL NULL NULL
001 10000 FP002 2011-11-12 3000 NULL NULL NULL
001 10000 FP003 2011-11-13 5000 NULL NULL NULL
001 10000 NULL NULL NULL P002 2011-11-12 3000
001 10000 NULL NULL NULL P003 2011-11-12 7000
我想到到这样一个结果
orderId orderSummoney invoiceId invoiceDate invoiceMoney payId payDate payMoney
001 10000 FP001 2011-11-11 2000 P002 2011-11-12 3000
001 10000 FP002 2011-11-12 3000 P003 2011-11-12 7000
001 10000 FP003 2011-11-13 5000 NULL NULL NULL
不知道怎么弄?
orderId orderSummoney invoiceId invoiceDate invoiceMoney payId paydate payMoney
001 10000 FP001 2011-11-11 2000 NULL NULL NULL
001 10000 FP002 2011-11-12 3000 NULL NULL NULL
001 10000 FP003 2011-11-13 5000 NULL NULL NULL
001 10000 NULL NULL NULL P002 2011-11-12 3000
001 10000 NULL NULL NULL P003 2011-11-12 7000
我想到到这样一个结果
orderId orderSummoney invoiceId invoiceDate invoiceMoney payId payDate payMoney
001 10000 FP001 2011-11-11 2000 P002 2011-11-12 3000
001 10000 FP002 2011-11-12 3000 P003 2011-11-12 7000
001 10000 FP003 2011-11-13 5000 NULL NULL NULL
不知道怎么弄?
作者: tanweizlf 发布时间: 2011-12-15
没有看清楚按照什么规则来合并?
作者: fredrickhu 发布时间: 2011-12-15
简单说明一下
a b c d
a1 b1 null null
a1 b2 null null
a1 b3 null null
a1 null c1 d1
a1 null c2 d2
我想变成
a b c d
a1 b1 c1 d1
a1 b2 c2 d2
a1 b3 null null
原来c d 字段前几行是NULL
我想把c d 字段 后面有内容的往上移
a b c d
a1 b1 null null
a1 b2 null null
a1 b3 null null
a1 null c1 d1
a1 null c2 d2
我想变成
a b c d
a1 b1 c1 d1
a1 b2 c2 d2
a1 b3 null null
原来c d 字段前几行是NULL
我想把c d 字段 后面有内容的往上移
作者: tanweizlf 发布时间: 2011-12-15
这种不是数据库的思路
虽然硬要做可以做
建议换思路
虽然硬要做可以做
建议换思路
引用 2 楼 tanweizlf 的回复:
简单说明一下
a b c d
a1 b1 null null
a1 b2 null null
a1 b3 null null
a1 null c1 d1
a1 null c2 d2
我想变成
a b c d
a1 b1 c1 d1
a1 b2 c2 d2
a1 b3 null null
原来c d 字段前几行是NULL
我想把c d 字段 后面有内容的往上移
简单说明一下
a b c d
a1 b1 null null
a1 b2 null null
a1 b3 null null
a1 null c1 d1
a1 null c2 d2
我想变成
a b c d
a1 b1 c1 d1
a1 b2 c2 d2
a1 b3 null null
原来c d 字段前几行是NULL
我想把c d 字段 后面有内容的往上移
作者: geniuswjt 发布时间: 2011-12-15
楼主是按什么方法得出的结果集
作者: pengxuan 发布时间: 2011-12-15
相关阅读 更多
热门阅读
-
office 2019专业增强版最新2021版激活秘钥/序列号/激活码推荐 附激活工具
阅读:74
-
如何安装mysql8.0
阅读:31
-
Word快速设置标题样式步骤详解
阅读:28
-
20+道必知必会的Vue面试题(附答案解析)
阅读:37
-
HTML如何制作表单
阅读:22
-
百词斩可以改天数吗?当然可以,4个步骤轻松修改天数!
阅读:31
-
ET文件格式和XLS格式文件之间如何转化?
阅读:24
-
react和vue的区别及优缺点是什么
阅读:121
-
支付宝人脸识别如何关闭?
阅读:21
-
腾讯微云怎么修改照片或视频备份路径?
阅读:28