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
 SQL Server 2000 Forums
 SQL Server Development (2000)
 Difficult SORT

Author  Topic 

neutcomp
Posting Yak Master

111 Posts

Posted - 2002-12-13 : 09:58:28
Can you help me?

Table: team, year, klass, relation
team: team_id, team_name
year: year_id, year_name
klass: klass_id, klass_name
relation: rel_id, team_id, year_id, klass_id

What I want is to view all available relations. And I want to sort them first with years DESC (2002, 2001, 2000, etc) then with team. And finally with klass.

Preview
Team:      klass: year:
Victory 1  | 1  |   2003
Victory 1  | 1  |   2002
Victory 2  | 1  |   2002
Victory 3  | 2  |   2002
Victory 4  | 4  |   2002
Victory 2  | 2  |   2001

Etc.

Thanxx



Cya
Bjorn

nr
SQLTeam MVY

12543 Posts

Posted - 2002-12-13 : 10:09:44
Just join all the tables to relation using the relevant id then order by year desc, team, klass

==========================================
Cursors are useful if you don't know sql.
DTS can be used in a similar way.
Beer is not cold and it isn't fizzy.
Go to Top of Page
   

- Advertisement -