Wrox Programmer Forums
|
SQL Language SQL Language discussions not specific to a particular RDBMS program or vendor.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the SQL Language section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old March 23rd, 2006, 07:55 AM
Registered User
 
Join Date: Mar 2006
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default Distinct Query

Hi,

I have the a table (subscribers) where the key columns here are subscriberid, email, firstname, lastname. e.g.

subriberid email firstname surname
---------------------------------------------------
01 [email protected] alan smith
02 [email protected] brian jones
03 [email protected] chris woods
04 [email protected] alan smith

If I use "select distinct email from subscribers" I get:

email
-----
[email protected]
[email protected]
[email protected]

But what query would I use to return *all* data but where the email is unique? i.e.

subriberid email firstname surname
---------------------------------------------------
01 [email protected] alan smith
02 [email protected] brian jones
03 [email protected] chris woods

Thanks for your help.

Ronnie

 
Old March 23rd, 2006, 08:27 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 839
Thanks: 0
Thanked 1 Time in 1 Post
Default

What happens if you also had a row like:

05 [email protected] john doe

which row is the 'correct" one for email address [email protected]?


Jeff Mason
Custom Apps, Inc.
www.custom-apps.com
 
Old March 23rd, 2006, 08:36 AM
Registered User
 
Join Date: Mar 2006
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I've had a look at the data and the duplicate emails contain duplicate information throughout.








Similar Threads
Thread Thread Starter Forum Replies Last Post
Using Distinct Smeghead SQL Server 2005 9 December 17th, 2007 11:10 AM
Distinct Eddywardo SQL Server 2005 1 September 2nd, 2006 07:41 AM
Select Distinct kirkmc Excel VBA 3 May 5th, 2006 07:55 PM
Distinct SELECT DISTINCT question... EndEffect Classic ASP Databases 4 August 18th, 2005 08:53 AM
Join Query Distinct and Top 1 ahanson SQL Language 4 November 30th, 2004 01:29 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.