Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations MikeeOK on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Duplicates (distinct doesnt work)

Status
Not open for further replies.

mymou

Technical User
May 21, 2001
355
GB


Hi All

Need to delete some duplicates:

select distinct *
into #temp_table
from table_name

Doesn't work, as one of the columns has a text data type and distinct cannot be used on this data type.

My SQL isnt up to this. Help.


Stew
 


Beat you too it this time!!


select news_title, max(news_id) as news_id into #temp1
from news_data
group by news_title

select news_data.*
from news_data, #temp1
where #temp1.news_id = news_data.news_id

Just never thought about using an ID in an aggreggate function before.

Stew
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top