2条回答 默认 最新
- Check_Const 2022-11-22 16:00关注
可以尝试用全连接 FULL join (FULL OUTER JOIN)
-- SQL Server 测试 (Oracle语法大部分类似) select case when A.物品名称 is not null then A.物品名称 else B.物品名称 end 物品名称, case when A.goods_id is not null then A.goods_id else B.material_id end 物品ID, case when A.supplier_id is not null then A.supplier_id else B.provider_id end 供应商ID, A.订单价格,B.进货价格 from ( select '足球' as 物品名称,'A001' as goods_id,'G001' as supplier_id,100 as 订单价格 union all select '排球' as 物品名称,'A004' as goods_id,'G004' as supplier_id,120 as 订单价格 ) as A Full join ( select '足球' as 物品名称,'A001' as material_id,'G001' as provider_id,50 as 进货价格 union all select '羽毛球' as 物品名称,'A002' as material_id,'G002' as provider_id,10 as 进货价格 union all select '乒乓球' as 物品名称,'A003' as material_id,'G003' as provider_id,5 as 进货价格 ) B on A.goods_id=B.material_id and A.supplier_id=B.provider_id
本回答被题主选为最佳回答 , 对您是否有帮助呢?解决 无用评论 打赏 举报
悬赏问题
- ¥15 乘性高斯噪声在深度学习网络中的应用
- ¥15 运筹学排序问题中的在线排序
- ¥15 关于docker部署flink集成hadoop的yarn,请教个问题 flink启动yarn-session.sh连不上hadoop,这个整了好几天一直不行,求帮忙看一下怎么解决
- ¥30 求一段fortran代码用IVF编译运行的结果
- ¥15 深度学习根据CNN网络模型,搭建BP模型并训练MNIST数据集
- ¥15 C++ 头文件/宏冲突问题解决
- ¥15 用comsol模拟大气湍流通过底部加热(温度不同)的腔体
- ¥50 安卓adb backup备份子用户应用数据失败
- ¥20 有人能用聚类分析帮我分析一下文本内容嘛
- ¥30 python代码,帮调试,帮帮忙吧