Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

SELECT LAST OCCURENCE DATA

Posted on 2011-10-27
3
Medium Priority
?
278 Views
Last Modified: 2012-08-14
Hi All,

I have below data :

Id   Date  
A    01/01/2011
A    02/01/2011
B    01/01/2011
C    01/01/2011
C    02/01/2001

Expected Result :

A    02/01/2011
B    01/01/2011
C    02/01/2001

How could I do it ?

Thank you.

0
Comment
Question by:emi_sastra
3 Comments
 
LVL 143

Accepted Solution

by:
Guy Hengel [angelIII / a3] earned 2000 total points
ID: 37038521
check this article out:
http://www.experts-exchange.com/A_3203.html

you can see how to do it, especially if you need data from more columns ...
0
 
LVL 74

Expert Comment

by:sdstuber
ID: 37038554
s elect id, max(date) from yourtable group by id
0
 
LVL 1

Author Comment

by:emi_sastra
ID: 37038684
Hi angelIII,

The article is great.

Thank you very much for your help.
0

Featured Post

How to Use the Help Bell

Need to boost the visibility of your question for solutions? Use the Experts Exchange Help Bell to confirm priority levels and contact subject-matter experts for question attention.  Check out this how-to article for more information.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

An alternative to the "For XML" way of pivoting and concatenating result sets into strings, and an easy introduction to "common table expressions" (CTEs). Being someone who is always looking for alternatives to "work your data", I came across this …
This month, Experts Exchange sat down with resident SQL expert, Jim Horn, for an in-depth look into the makings of a successful career in SQL.
This video shows how to quickly and easily deploy an email signature for all users in Office 365 and prevent it from being added to replies and forwards. (the resulting signature is applied on the server level in Exchange Online) The email signat…
With just a little bit of  SQL and VBA, many doors open to cool things like synchronize a list box to display data relevant to other information on a form.  If you have never written code or looked at an SQL statement before, no problem! ...  give i…

810 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question