sql - Get count(*) > 1 field value -


i have following query uses membership table , user table. emails have count(*) > 1, show username well.

 select au.username, am.email         [dbo].[aspnet_membership]  join aspnet_users au  on am.userid = au.userid  group am.email  having count(*) > 1  order email  

not sure how it. tried using max(au.username) give me first username , not of them

using count window function.

select username,email (select au.username,am.email, count(*) over(partition am.email) cnt_per_email              [dbo].[aspnet_membership]       join aspnet_users au on am.userid = au.userid      ) t cnt_per_email>1 

Comments

Popular posts from this blog

What is happening when Matlab is starting a "parallel pool"? -

angular - DownloadURL return null in below code -

php - Cannot override Laravel Spark authentication with own implementation -