Table name = Contacts.
Table attributes = first_name,last_name,email_address,other_email,address,phone,notes.

I want to retrieve without repetition(DISTINCT) first_name and address. But, when retrieving these 2 data, i want all the other data(notes,last_name,etc..) associated to this the DISTINCT data to show.

Is there any SQL data for this kind of situation?

Give some example data and the result you want.

For eg, my database table is this.

First_name Last_name TelphoneNo Email_addr HomeAddr
Abu Thahir 90338833 thahir@hotmail.com Blk 143, hil ave..
Abu Thahir 90338833 thahir@hotmail.com Blk 143, hil ave..
Syed Thahir 90848443 thakjdr@hotmail.com Blk 143, hil ave..
Syed Thahir 90843877 thjhfir@hotmail.com Blk 143, hil ave..

I want to use SQL to Select All DISTINCT First_name and E-mail. While, all my Distinct results comes out, i want my address,telphoneNo,last_Name to come out too.

Is it possible to achive it???

For eg, my database table is this.

First_name, Last_name, TelphoneNo, Email_addr, HomeAddr
Abu Thahir 90338833 thahir@hotmail.com Blk 143, hil ave..
Abu Thahir 90338833 thahir@hotmail.com Blk 143, hil ave..
Syed Thahir 90848443 thakjdr@hotmail.com Blk 143, hil ave..
Syed Thahir 90843877 thjhfir@hotmail.com Blk 143, hil ave..

I want to use SQL to Select All DISTINCT First_name and E-mail. While, all my Distinct results comes out, i want my address,telphoneNo,last_Name to come out too.

Is it possible to achive it??? thahir
Reputation Points: 10
Solved Threads: 0Newbie Poster
Online
2 posts
since Nov 2009
Flag Bad Post Edit Post Reply

I think you cannot use DISTINCT. But you can use GROUP BY command because you want to display Address, telphoneNo and last_Name. And you must determine which row will be displayed if there are more than 1 double row in First_Name and E-Mail.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.