Advertisement

10.03.2008 at 07:54AM PDT, ID: 23785184
[x]
Attachment Details
[x]
The Solution Rating System

With so many solutions, how can you tell which solutions are most likely to help you and which ones are not? To provide you with a tool to use, we rate our solutions based on various elements that most accurately determine if a solution is a quality solution. To explain what factors affect the solution rating, here are the elements we take into consideration when formulating our solution rating.

  • The Grade of the Solution
  • The Zone Rank of the Expert Providing the Solution
  • The Number of Author and Expert Comments
  • The Number of Experts Contributing
  • The Feedback of the Community

Your Input Matters
Because of the way the system is set up, the most important variable in this equation is you. As a member of Experts Exchange, you are able to cast your vote on the quality of the solutions in regard to how complete, accurate, helpful and easy to understand each solution is. When you provide your feedback, each rating is adjusted accordingly. So, if you see a solution that has a poor rating that you think is a good solution, let us know by rating it. As you do, the rating will be adjusted and will become more accurate for other members of our site.

If you have any suggestions that you would like to make for our rating system, please ask a question in the Suggestions Zone of Community Support.

Thank you!

9.3

Get max date from data with common identifier

Asked by johnnie240 in MS SQL Server, SQL Server 2005

Tags:

I am trying to get a list of the latest dates for each organization from the following table:

SELECT     OrganizationRatingID, OrganizationID, StartDate
FROM         AMS.OrganizationRating
ORDER BY OrganizationID, StartDate

OrganizationRatingID, OrganizationID, StartDate
293      60      2008-07-29 00:00:00.000
3      93      1995-11-01 00:00:00.000
1      93      2005-05-25 00:00:00.000
2      93      2007-04-20 00:00:00.000
5      94      1987-06-30 00:00:00.000
4      94      1997-02-12 00:00:00.000
6      94      2000-06-01 00:00:00.000
7      94      2008-01-18 00:00:00.000
243      94      2008-06-05 00:00:00.000
261      94      2008-06-05 00:00:00.000

I am able to get a list without the OrganizationRatingID that does that with the following query, but I need that in order to get the Rating for each Organization:

SELECT     AMS.OrganizationRating.OrganizationID, MAX(AMS.OrganizationRating.StartDate) AS StartDate
FROM         AMS.OrganizationRating INNER JOIN
                      AMS.OrganizationRating AS OrganizationRating_1 ON AMS.OrganizationRating.OrganizationID = OrganizationRating_1.OrganizationID
GROUP BY AMS.OrganizationRating.OrganizationID
Order By OrganizationID, StartDate

I tried taking the resuts of that query and then doing a join with the table again where the StartDate = #Tmp.StartDate, but I found that the users had updated some organizations twice in a dayStart Free Trial
[+][-]10.03.2008 at 07:58AM PDT, ID: 22634618

View this solution now by starting your 7-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zones: MS SQL Server, SQL Server 2005
Tags: SQL
Sign Up Now!
Solution Provided By: chapmandew
Participating Experts: 1
Solution Grade: A
 
 
 
Loading Advertisement...
20080716-EE-VQP-32 - Hierarchy / EE_QW_2_20070628