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 |
|
WinterPhoenix
Starting Member
2 Posts |
Posted - 2008-03-26 : 22:08:02
|
| For a class I am taking, I have to write a SQL statement to return emails that show up in a table more than once. The schema for the table is:Table: UsersEmail - Varchar(75)City - Varchar(75)State - Char(2)I have a proposed solution, but I am not sure it would work since there is no concrete implementation of this. The class is still doing basic SQL, so forgive my inexperience.SELECT Email FROM Users WHERE (COUNT(Email) > 1)Is this a valid solution? Thank you for any helpWinterPhoenix |
|
|
nr
SQLTeam MVY
12543 Posts |
Posted - 2008-03-26 : 22:13:29
|
| nope - needs a group by clauseSELECT EmailFROM Usersgroup by Emailhaving count(*) > 1Don't you have anything you can test a query on?If not download sql server express and install it.Access would probably do as well.==========================================Cursors are useful if you don't know sql.DTS can be used in a similar way.Beer is not cold and it isn't fizzy. |
 |
|
|
WinterPhoenix
Starting Member
2 Posts |
Posted - 2008-03-26 : 22:22:58
|
| Thank you very much, nr. I don't have a proper testing environment, but the actual course only touches on SQL for another couple days. As a software engineering student, however, I certainly should learn database management - and soon. |
 |
|
|
X002548
Not Just a Number
15586 Posts |
|
|
|
|
|