>>In your case the condition
>>
>>What has to be adjusted is that if the select has Company.Activated=True, I need to obtain 2. If it is False, I need to obtain 3.
>>
>>is reversed.
>
>Yes, I reversed it.
>
>>Also, do you have just one row in the company for numero and want to check if it's activated or not? You can change EXISTS to be
>>
>>(select 1 from Company where Numero = Client.NoCompany and Activated = 0)
>
>Yes, that is unique.
Ok, exists version should be better. Just use exists (select 1 from ...)
If it's not broken, fix it until it is.
My Blog