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.

 All Forums
 SQL Server 2005 Forums
 Transact-SQL (2005)
 How to dedup the entire row based on two variables

Author  Topic 

tamancha.1
Starting Member

37 Posts

Posted - 2010-04-28 : 13:22:18
How to dedup the entire row based on two variables in SQL?

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2010-04-28 : 13:27:24
You'll need to show us a data example to be more clear.

Tara Kizer
Microsoft MVP for Windows Server System - SQL Server
http://weblogs.sqlteam.com/tarad/

Subscribe to my blog
Go to Top of Page

tamancha.1
Starting Member

37 Posts

Posted - 2010-04-28 : 16:43:40
Table 1

time_stamp user_id ip ad
1/4/2010 10:14:58 576460854838916000 64.12.112.140 1177054
1/4/2010 10:14:58 576460854838916000 99.148.205.225 1177054
1/5/2010 18:07:00 2305843014859140000 74.193.38.94 1177054
2/15/2010 12:21:23 885371972114972000 97.73.240.224 1177054
2/15/2010 12:21:23 885371972114972000 97.73.240.224 1177054

I want to keep one(any)top row for each user_id?
Go to Top of Page

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2010-04-28 : 17:26:44
Check out the ROW_NUMBER() function if you are using 2005 or 2008.

Tara Kizer
Microsoft MVP for Windows Server System - SQL Server
http://weblogs.sqlteam.com/tarad/

Subscribe to my blog
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2010-04-29 : 03:53:36
Refer point 3
http://beyondrelational.com/blogs/madhivanan/archive/2008/09/12/return-top-n-rows.aspx

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page

tamancha.1
Starting Member

37 Posts

Posted - 2010-04-30 : 11:30:36
Yes, That helps. Thanks.
Go to Top of Page
   

- Advertisement -