Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
Author |
Topic |
rwasim25
Starting Member
13 Posts |
Posted - 2010-08-23 : 02:24:41
|
select convert(varchar,TBYVERS.CCIETEC)+'_'+TBYVERS.LNUMCON+'_'+convert(varchar,TBYVERS.NVRS) Policy_Reference, 'ACI' Business_Unit, (select case when TBYINCO.crolivn =2 and TBYINCO.dfin = '' then (select TBYRELA.LNOMBSE+' '+TBYRELA.LPRNBSE+' '+'-'+' '+convert(varchar,TBYRELA.NREL) from SIMC_TBYRELA TBYRELA where TBYRELA.nrel = TBYINCO.NREL and TBYINCO.CCIETEC = TBYVERS.CCIETEC and TBYINCO.LNUMCON = TBYVERS.LNUMCON) end from SIMM_TBYINCO TBYINCO) Insured_Name, 'Additional Insured' Insured_Type, NULL Insured_Code from SIMM_tbyvers TBYVERSits giving error : Msg 512, Level 16, State 1, Line 2Subquery returned more than 1 value. This is not permitted when the subquery follows =, !=, <, <= , >, >= or when the subquery is used as an expression. Can any one help why this so coz i have reference for all the tables.. The problem is in case statement.Wasim..Senior Test Engineer |
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2010-08-23 : 04:45:00
|
[code]select convert(varchar,TBYVERS.CCIETEC)+'_'+TBYVERS.LNUMCON+'_'+convert(varchar,TBYVERS.NVRS) Policy_Reference,'ACI' Business_Unit,x.Insured_Name,'Additional Insured' Insured_Type,NULL Insured_Codefrom SIMM_tbyvers TBYVERSINNER JOIN(select casewhen TBYINCO.crolivn =2 and TBYINCO.dfin = '' then TBYRELA.Val end AS Insured_Name,TBYINCO.CCIETEC ,TBYINCO.LNUMCON from SIMM_TBYINCO TBYINCOINNER JOIN (select LNOMBSE+' '+LPRNBSE+' '+'-'+' '+convert(varchar,NREL) AS Val,nrelfrom SIMC_TBYRELA) TBYRELAON TBYRELA.nrel = TBYINCO.NREL) xON x.CCIETEC = TBYVERS.CCIETEC andx.LNUMCON = TBYVERS.LNUMCON[/code]------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/ |
 |
|
|
|
|
|
|