Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 Reformat crosstab report

Author  Topic 

SQLCM
Starting Member

13 Posts

Posted - 2007-06-06 : 01:02:57
Thought I might get more respnose on this board.
This is the result I got from running a simple select query:

employee_ID last_name test_date test_score
34 Taylor 02/05/2006 85
85 Lomeli 03/15/2006 72
85 Lomeli 03/25/2006 78
110 smith 03/17/2006 90
110 smith 03/24/2006 89
110 smith 05/05/2006 92

How do I go from this format to the format below?
I would like the result to look like:

employee_ID last_name test_score_1 test_score_2
34 Taylor 85
85 Lomeli 72 78
110 Smith 90 89

Instead of having multiple rows for each employee, I would like to have one row for each empolyee and display top 2 test_scores in a single row.

Thanks for your expertise in advance.

khtan
In (Som, Ni, Yak)

17689 Posts

Posted - 2007-06-06 : 01:06:51
duplicate http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=84579

Please avoid cross post and continue over that thread.


KH

Go to Top of Page
   

- Advertisement -