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.

 All Forums
 SQL Server 2008 Forums
 Transact-SQL (2008)
 SSMS QUERY(SSMS 2008)

Author  Topic 

kond.mohan
Posting Yak Master

213 Posts

Posted - 2012-03-12 : 04:56:31


Hi

i am running one query in ssms 2008.

i have used 4 subquery in my main query

one of subquery is like this way

left join (select distinct count(FBH.BILL_ID) as id,
MAX(FBH.vfd_bod_Date) as date1 ,
FBM.PARTY_CODE
,FBM.BILL_PARAM_TYPE,
FBH.BP_LIAB_CRNCY
from dwh_staging..FBH

inner join dwh_staging..FBM on FBM.BILL_ID =FBH.BILL_ID
where fbh.bill_stat in ('R')--and FBM.PARTY_CODE ='10125003' --and FBM.PARTY_CODE ='25041777'
group by
FBM.BILL_PARAM_TYPE ,
fbm.party_code,FBH.DUE_DATE ,FBH.BILL_ID,
FBH.BP_LIAB_CRNCY
having MAX(FBH.vfd_bod_Date)>FBH.DUE_DATE


in above sub query i have used count(biil_id) and max(vfd_bod_Date)

columns

i am running my subquery its working fine where i run ENTIRE QUERY

I am getting this type error


Msg 245, Level 16, State 1, Line 1
Conversion failed when converting the nvarchar value '721A17111214001' to data type int.

can anobody know the solution pls help me

count of bill_id may be returning multiple values

mohan

webfred
Master Smack Fu Yak Hacker

8781 Posts

Posted - 2012-03-12 : 06:48:38
So you are showing us what "is working fine" and not what is giving the error???


No, you're never too old to Yak'n'Roll if you're too young to die.
Go to Top of Page
   

- Advertisement -