2013-08-26 3 views
0
outer apply 
( 
isnull(
    (select top 1 

     sea.Daily,   
     sea.SeasonId  
    from Season as sea  
    where sea.propertyId = prop.PropertyId and FromDate < @FromDate and ToDate > @ToDate 
    ), 
    (select top 1 sea.Daily,    
     sea.SeasonId    
     from Season as sea where sea.propertyId = prop.PropertyId) 
    )   
) as pri 

쓰기 오류 ')'근처에 구문이 잘못되었습니다. '근처에'키워드 근처의 구문이 잘못되었습니다.mssql isnull이 외부에서 작동하지 않습니다.

답변

1

누락 된 "선택"??

outer apply 
( 
SELECT isnull(
    (select top 1 

     sea.Daily,   
     sea.SeasonId  
    from Season as sea  
    where sea.propertyId = prop.PropertyId and FromDate < @FromDate and ToDate > @ToDate 
    ), 
    (select top 1 sea.Daily,    
     sea.SeasonId    
     from Season as sea where sea.propertyId = prop.PropertyId) 
    )   
) as pri 

주권

+0

하나 개의 표현 서브 쿼리가 존재합니다 도입하지 않을 때 선택 목록에서 지정할 수 있습니다. – Tatti

+0

@Tatti 어쩌면 직접 오류를 해결할 수 있습니다. Raj는 당신에게 기본적으로 해결책을주었습니다. – usr

+0

팁을 주셔서 감사합니다.) 많은 아이디어가 필요하지만 작동하는 솔루션이 필요합니다. – Tatti

관련 문제