Jump to content

Eliminating retrieving duplicate data


ylkien

Recommended Posts

Hi,

 

I am trying to get some data from a MS SQL database. The problem is that there are duplicate 'productid' exist. I would like to get the first 'id' from the 'productid' that occurs (based on first occurance).

 

For example, 'productid=22255805' occurs 2 times, with the 'id's 171866567 & 171868977. But, based on the time, i would only like to select 'id=171866567' cause it occurs first.

 

 

Thanks!

 

 

Here is a sample of the data.

 

 

 

 

 

id     productid       startedtime

171866567 22255805 2/15/2007 18:57:52

171868977 22255805 2/15/2007 19:23:38

171865835 22255809 2/15/2007 18:41:04

171866604 22255809 2/15/2007 19:04:15

171867946 22255809 2/15/2007 19:17:46

171867078 22255811 2/15/2007 19:11:34

171867659 22255844 2/15/2007 19:15:45

171866565 22255845 2/15/2007 18:56:24

171868611 22255845 2/15/2007 19:21:43

171867380 22255846 2/15/2007 19:13:50

171866554 22261980 2/15/2007 18:54:12

171868291 22261980 2/15/2007 19:19:49

171866578 22261995 2/15/2007 19:01:07

171869743 22261995 2/15/2007 19:27:27

171869333 22261998 2/15/2007 19:25:32

171870202 22261999 2/15/2007 19:29:23

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.