You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

编写SQL查询实现基于关联列填充number字段NULL值的需求

数据处理需求与结果

原始数据表格

master_codeidtypenumber
nullabcsjjjjsUVdoo852456
abcsjjjjsUViydjfjdwwtoo951753
abcsjjjjsUVretslslfdftoonull

number字段处理规则

  • 当type = 'doo'时,保留number字段的原始值;
  • 当type = 'too'且number不为null时,保留number字段的原始值;
  • 当type = 'too'且number为null时,将该记录的master_code与type = 'doo'的记录的id进行匹配,用匹配到的记录的number值填充当前null。

预期处理结果表格

master_codeidtypenumber
nullabcsjjjjsUVdoo852456
abcsjjjjsUViydjfjdwwtoo951753
abcsjjjjsUVretslslfdftoo852456

内容的提问来源于stack exchange,提问作者Jainam Furia

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.06.27 00:33:25