Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
ljp099
Yak Posting Veteran
79 Posts |
Posted - 2007-10-18 : 01:40:25
|
| what is the query to select * non distinct values?I want to make the "email" column in my db have a unique index. In order to do so, I need to find all the email values which are not distinct. What is the query?Select email from users where email is not distinct ? |
|
|
Julien.Crawford
Starting Member
21 Posts |
Posted - 2007-10-18 : 01:44:40
|
| select value from table group by value having count(*) > 1 |
 |
|
|
ljp099
Yak Posting Veteran
79 Posts |
Posted - 2007-10-18 : 03:19:12
|
| thanks |
 |
|
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2007-10-18 : 04:01:19
|
[code]SELECT Col1, Col2FROM ( SELECT Col1, Col2, COUNT(*) OVER (PARTITION BY eMail) AS Items FROM Table1 ) AS dWHERE Items > 1[/code] E 12°55'05.25"N 56°04'39.16" |
 |
|
|
|
|
|