views:

41

answers:

1

Hi, This is what I'm trying to do something similar to the following request, but I don't know if it's possible with the SQL-Server syntax:

declare @idClient int

select @idClient=idClient from table
where entite is null and (SELECT * from table where entite=@idClient) is null 

Thanks.

+1  A: 

Maybe this?

SELECT t1.[idClient]
FROM   [table] t1
WHERE  [entite] IS NULL 
       AND NOT EXISTS (
           SELECT NULL
           FROM   [table] t2
           WHERE  t2.[entite]=t1.[idClient]
       )
Alex