Sub query does not work within in ISNULL() in SQLObject Advanced Queries

Sub query does not work within in ISNULL() in SQLObject Advanced Queries

  

Hi team,


I encountered an error when i called a sub Query with in a ISNULL() in SQL query Syntax in SQL Obecjt Advance Query.

Kindly Help

here is the sample query:

SyntaxEditor Code Snippet

SELECT  {User}.[Id], 
        {User}.[Username], 
        ISNULL({TimelineLockingByUsers}.[AppraiserEditModeFromDate], SELECT {Timelines}.[AppraiserEditModeFromDate] FROM {Timelines} WITH(NOLOCK) WHERE {Timelines}.[Id] = @TimelineId) AS EditModeFromDate, 
        ISNULL({TimelineLockingByUsers}.[AppraiserEditModeTillDate], SELECT {Timelines}.[AppraiserEditModeTillDate] FROM {Timelines} WITH(NOLOCK) WHERE {Timelines}.[Id] = @TimelineId) AS EditModeTillDate
FROM {User} WITH(NOLOCK) 
        INNER JOIN {UserRelations} WITH(NOLOCK) ON {User}.[Id] = {UserRelations}.[UserId]
        LEFT JOIN {TimelineLockingByUsers} WITH(NOLOCK) ON  {UserRelations}.[Id] = {TimelineLockingByUsers}.[UserRelationId] 
                                                        AND {TimelineLockingByUsers}.[TimelineId] = @TimelineId
        WHERE {UserRelations}.[AppraiserId] = @AppraiserId
Solution

You didn't tell us what the error says, but I'm pretty sure the SELECT statements inside the ISNULL function need to be wrapped in parentheses.

Solution

João Pedro Abreu wrote:

You didn't tell us what the error says, but I'm pretty sure the SELECT statements inside the ISNULL function need to be wrapped in parentheses.

Thanks Dude! 

It worked for me.