select
	substring(distinct_id similar '%#"@%#"' escape '#') as group
from
	session
where
	distinct_id is not null
	and distinct_id like '%@%'
group by
	substring(distinct_id similar '%#"@%#"' escape '#')
	;

