Advertisement

07.08.2008 at 03:42AM PDT, ID: 23546078
[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.9

Earliest record - query help please.

Asked by G0ggy in SQL Query Syntax, SQL Server 2005

Tags:

Hi all,

I'm struggling to get my head around the syntax to achieve my results. The scenario is this, users can take assessments as many times as they wish, but only the first assessment score is of significance. The data is held in three tables, AssessmentResult (for the assessment score, date taken, course ID and the user ID), UserData (for the users name) and the Courses table (which holds the course names).

In joining them the AssessmentResults table would join to the UserData table by the UserID and the Courses table would join to the AssessmentResults table by the CourseID, this then produces a list of results:

16      49      12      8      93      3      2004-11-08 16:59:24.560      David J Smith      Basic Electrics
17      12      39      3      80      2      2004-11-15 12:03:19.247      Tim Simcock      Inspirational Leadership of Service and Parts Departments
18      12      39      3      84      2      2004-11-15 14:15:51.873      Tim Simcock      Inspirational Leadership of Service and Parts Departments

As you can see a chap called Tim Timcock has taken an assessment on course 12 twice, the only result we're concerned with is the earliest one (taken first) which is 2004-11-15 12:03:19.247.

Attached is the SQL which produced the results above, can someone expand it so we only get a single, earliest, value for each assessment?

Thanks.Start Free Trial
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
select ar.RecordID, 
	ar.UserID,
	ar.CourseID,
	ar.AssessmentID,
	ar.Result,
	ar.Pass,
	ar.Date_Created,
	ud.Fname + ' ' + ud.Sname as fullName,
	co.CourseName
	from dbo.AssessmentResult ar
	inner join dbo.UserData ud on ar.UserID = ud.UserID
	inner join dbo.Course co on ar.CourseID = co.CourseID
	order by ar.Date_Created ASC
[+][-]07.08.2008 at 03:48AM PDT, ID: 21952455

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: SQL Query Syntax, SQL Server 2005
Tags: SQL (T-SQL)
Sign Up Now!
Solution Provided By: aneeshattingal
Participating Experts: 1
Solution Grade: A
 
 
 
Loading Advertisement...
20080716-EE-VQP-32 / EE_QW_2_20070628