子查询返回的值超过1。这是不允许的,当子查询遵循=,!=,<, <= , >,> =

问题描述:

我不断收到此错误消息,我尝试了一些我发现但没有任何工作的东西。这里是我的子查询;子查询返回的值超过1。这是不允许的,当子查询遵循=,!=,<, <= , >,> =

icd9_code =(select icd9_code from paragon_rpt.dbo.TSM910_ICD9_REF 
     where icd9_int_id = (select Top 2 (icd9_int_id) from paragon_rpt.dbo.TPM317_VISIT_PROCEDURE 
         where vst_int_id =a.vst_int_id 
         and 
         icd9_int_id in (Select icd9_int_id from SGMH_Reports.dbo.NHSN_ICD10_2) 
         )), 
+2

请阅读您的问题标题。这是你的问题的答案。 – Quassnoi

+0

用'in'替换'='以允许多个值 –

+0

@Lashane我也试过这个..但是改成in给了我同样的错误icd9_code =(从paragon_rpt.dbo.TSM910_ICD9_REF选择icd9_code 其中icd9_int_id in(选择Top 2从paragon_rpt.dbo.TPM317_VISIT_PROCEDURE(icd9_int_id) \t \t \t \t \t \t \t \t \t \t \t \t 其中vst_int_id = a.vst_int_id 和 icd9_int_id在(从SGMH_Reports.dbo.NHSN_ICD10_2选择icd9_int_id) )), – Jules

在a.vst_in_id之后添加a)之后将=改为工作。

icd9_code =(从paragon_rpt.dbo.TSM910_ICD9_REF 选择icd9_code其中icd9_int_id在(从paragon_rpt.dbo.TPM317_VISIT_PROCEDURE 选择顶部2(icd9_int_id)其中vst_int_id = a.vst_int_id) 和 icd9_int_id在(从SGMH_Reports选择icd9_int_id .dbo.NHSN_ICD10_2)),

非常感谢您的帮助!