Error in Advance Query



I know this is not right forum to post sql related questions but still can anyone please help me.

I have written advance query like this 

When I have added this part enclosed in bracket, query started giving this error.

Please advice. What I am missing.

Thanks and Regards,

Suraj Borade

Hi Suraj,

Your sub-query is returning more than 1 row, you can simply use Top 1 in select statement and 

if required along with Top you can use Rank() as well for filtering the desired result.

I hope this will work.


Manish Jawla

Hi Suraj,

I think the Max() function should return only 1 value. I think there is a missing condition in the Where Statement of your Sub query.

Also, in the event that the Sub Query return multiple rows, you should use IN operator or EXISTS. Depending on the nature of your SQL.

Thanks and regards,