select
	kolumny
from dbo.tab1
inner join
full join
	where
			-------
		group by
		having count (*) - distinct
		order by