Your syntax is not valid. You seem to be looking for tuple equality:
where (nom, prenom, mail, trig) in (
select mail, nom, mail, trig
from ...
)
Few databases support this syntax, and SQL Server is not one of them.
It seems like you want to exhibit duplicates. You could use exists, but you would need a primary key column (or set of columns), and it is not obvious which one it would be from looking at the query. Assuming id
:
select r.*
from dbo.reseau r
where exists (
select 1
from dbo.reseau r1
where
r1.id <> r.id
and r1.nom = r.nom
and r1.prenom = r.prenom
and r1.mail = r.mail
and r1.trig = r.trig
)
I think this would be simpler expressed with a window count:
select *
from (
select r.*, count(*) over(partition by nom, prenom, mail, trig) cnt
from dbo.reseau r
) r
where cnt > 1