June 8, 2005 at 2:44 pm
I have a data set that contains entity ids (these may be in the table multiple times) and also date information. So I may have an entity id of 1 3 times with three different dates. What I am trying to do is return each unique entity id along with the earliest date associated with that id.
I know that we used to do this in Access with a Group By and choosing First but I can't figure out how to go about it in SQL. Any suggestions would be great. Thanks.
June 8, 2005 at 2:45 pm
Select id, min(DateCol) as EarlyDate
from dbo.YourTable
Group by id
June 8, 2005 at 3:00 pm
Thank you very much Remi. I was making it way to complicated to ever figure out it was that easy. Thanks again.
June 8, 2005 at 3:03 pm
The simplest solutions are always (almost) the best.
HTH.
June 8, 2005 at 5:53 pm
From Google:
50 First Dates - Cast, Crew, Reviews, Plot Summary, Comments, Discussion, Taglines, Trailers, Posters, Photos, Showtimes, Link to Official Site, Fan Sites.http://www.imdb.com/title/tt0343660/ - 53k - Jun 7, 2005 - <A class=fl href="http://72.14.207.104/search?q=cachehO4LBHxjPAJ:www.imdb.com/title/tt0343660/+first+date&hl=en target=nw">Cached - Similar pages |
A teenager is going out on her first date, and she discusses the details with her father.http://www.esl-lab.com/dating/datingrd1.htm - 9k - Cached - Similar pages |
Guys Dating Secrets, Dating Tips, Kissing Women, Love, Romance ...
Art of Kissing Single Women on Your First Date Take her to paradise with your kiss!!! At the end of a first date comes that awkward moment when you must ...http://www.links2love.com/guys.htm - 53k - Cached - Similar pages |
Just couldn't resist
June 8, 2005 at 6:06 pm
Hehe.
June 9, 2005 at 1:16 am
Have you tried that also on the Google Groups?
<A href="http://groups.google.de/groups?q=first+date&hl=de ">http://groups.google.de/groups?q=first+date&hl=de
--
Frank Kalis
Microsoft SQL Server MVP
Webmaster: http://www.insidesql.org/blogs
My blog: http://www.insidesql.org/blogs/frankkalis/[/url]
June 9, 2005 at 6:38 am
You guys have too much time on your hands.
June 9, 2005 at 6:41 am
Amazing, to hear that from you...
--
Frank Kalis
Microsoft SQL Server MVP
Webmaster: http://www.insidesql.org/blogs
My blog: http://www.insidesql.org/blogs/frankkalis/[/url]
June 9, 2005 at 6:54 am
Good point .
Viewing 10 posts - 1 through 9 (of 9 total)
You must be logged in to reply to this topic. Login to reply