0
contract  rec  #     state  dealer  coverage
--------  ---  ----  -----  ------  --------
55661     1    YUFL  FL     GP      GP15  
55661     2    YUFL  FL     GP    
55662     1    YUFL  FL     GP      GP16  
55662     2    YUFL  FL     GP

REC '2' 的覆盖范围字段为空。如何使用来自 REC'1' 的相同数据和相同的合同 # 填充覆盖范围字段?表名:contract_ex

IE

55661 REC'2' coverage s/b GP15
55662 REC'2' coverage s/b GP16
4

1 回答 1

2

尝试这个:

SELECT  contract,
        rec,
        state,
        dealer,
        (SELECT coverage FROM YourTable
         WHERE contract = T.contract AND rec = 1) coverage
FROM YourTable T
于 2013-06-27T17:01:42.510 回答