Click to See Complete Forum and Search --> : Sorting in query help?


edustreet
04-11-2007, 06:20 AM
Hi,

Table:
Name Subject Grade
Jason 1 A
Jason 2 A
Jason 3 A
Elvis 1 A
Elvis 2 A
Elvis 3 B
John 1 A
John 2 C
John 3 B

Output:
Name 1 2 3
Jason A A A
Elvis A A B
John A C B

Is that possible to get the result from the above? For what I want is the student who get more distinction subject will be at the top. It is not like this "select ... from ... order by 1,2,3"

Any suggestion and help will be more appreciate. Thanks

Calvin

Phil Weber
04-11-2007, 08:45 AM
What database are you using?

edustreet
04-11-2007, 09:33 PM
MS SQL Server 2005

Phil Weber
04-12-2007, 01:45 AM
See if this helps: http://www.databasejournal.com/features/mssql/article.php/3521101

edustreet
04-17-2007, 04:05 AM
I'm sure using MS SQL 2005, but still get this error:

The PIVOT SQL construct or statement is not supported.