Search
 
SCRIPT & CODE EXAMPLE
 

SQL

grouping by email domain mysql

SELECT substring_index(email, '@', -1) domain, COUNT(*) email_count
FROM table
GROUP BY substring_index(email, '@', -1)

-- If you want to sort as well:
ORDER BY email_count DESC, domain;
Comment

PREVIOUS NEXT
Code Example
Sql :: select place default lat long 
Sql :: how to do a function to return row type from a table in pl/sql 
Sql :: how to make sure two tables have same exact data in sql 
Sql :: join 
Sql :: linked server delete openquery 
Sql :: how to write query to to display record having maximum value 
Sql :: SQL create table full of dates 
Sql :: uninstall mysql centos 7 
Sql :: updating mysql 
Sql :: table values functions in SQL 
Sql :: import sql inside hide sql 
Sql :: Grant read-only privilleges to the user 
Sql :: export all stored procedures to .sql files 
Sql :: systemctl mssql-server details 
Sql :: partitioning in oracle-base 
Sql :: tsql rename column name 
Sql :: mysql unique two columns 
Sql :: sql wildcards 
Sql :: sql check if a record exists 
Sql :: bulk insert sql query syntax 
Sql :: smalldatetime in sql 
Sql :: add column in table in sql 
Csharp :: unity get number of child objects 
Csharp :: c# sleep 
Csharp :: how to check the tag of a collider in unity 
Csharp :: ALWAYS MAximize window on start c# 
Csharp :: c# if file exists 
Csharp :: how to wait in c# 
Csharp :: unity editor select object in script 
Csharp :: usermanager change password without current password 
ADD CONTENT
Topic
Content
Source link
Name
9+9 =