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 |
|
Topaz
Posting Yak Master
199 Posts |
Posted - 2008-10-02 : 11:32:25
|
| Im wanting to find duplicate websites in my DB but have no idea how to do so.select * from table_name where (duplicates)Thats a poor effort but any ideas?JT |
|
|
wormz666
Posting Yak Master
110 Posts |
Posted - 2008-10-02 : 11:45:35
|
| try this Select *,dd from tbl_name temp1inner join (Select count(field_name),field_name as dd from tbl_name group by field_name) temp2 on temp1.field=temp2.fieldwhere dd > 1 |
 |
|
|
Topaz
Posting Yak Master
199 Posts |
Posted - 2008-10-02 : 11:49:43
|
| I get this error...Incorrect syntax near the keyword 'on'.JT |
 |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2008-10-02 : 12:11:48
|
| [code]SELECT *FROM table_name tJOIN(SELECT websiteFROM table_nameGROUP BY websiteHAVING COUNT(*) >1)tmpON tmp.website=t.website[/code] |
 |
|
|
Topaz
Posting Yak Master
199 Posts |
Posted - 2008-10-02 : 12:21:19
|
| Interesting result...Is there any way i can simply select website from my table. I tried this:SELECT websiteFROM table_name tJOIN(SELECT websiteFROM table_nameGROUP BY websiteHAVING COUNT(*) >1)tmpON tmp.website=t.websiteTo confirm all that is happening here the DB is finding duplicate websites?JT |
 |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2008-10-03 : 04:07:58
|
quote: Originally posted by Topaz Interesting result...Is there any way i can simply select website from my table. I tried this:SELECT websiteFROM table_name tJOIN(SELECT websiteFROM table_nameGROUP BY websiteHAVING COUNT(*) >1)tmpON tmp.website=t.websiteTo confirm all that is happening here the DB is finding duplicate websites?JT
first run thisSELECT websiteFROM table_nameGROUP BY websiteHAVING COUNT(*) >1 and see if it return only duplicately existing websites |
 |
|
|
|
|
|