sanjay
sanjay

Reputation: 1020

Eliminate duplicate data from table sql

I have a mysql table containing with bunch of duplicate data. for example

ID           Visited URL

1             google.com
1             facebook.com
1             google.com
1             facebook.com
2             google.com
2             google.com

I need to avoid these duplicate rows and get unique rows as follows.

ID           Visited URL

1            google.com
1            facebook.com
2            google.com

How could I do that? any suggestions??

Upvotes: 0

Views: 35

Answers (2)

Fappie.
Fappie.

Reputation: 490

What about SELECT DISTINCT ID, Visited URL FROM YOUR TABLE..

It will only gives you non duplicated rows;

Upvotes: 0

Ormoz
Ormoz

Reputation: 3013

you can use either of the following

 Select ID,VisitedURL from tablename group by ID,VisitedURL

or

 SELECT DISTINCT ID,VisitedURL from tablename

Upvotes: 2

Related Questions