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)
 group by query using 3 tables

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2000-12-17 : 11:29:30
Robsa writes "I have a case where I have 3 tables - SKILLS, CLIENTS and ABILITIES - one which hold a clients details (eg name, age etc) one which holds a list of various skills (eg. running, high jump etc) and the third table (ABILITIES) which holds a list of entries of clients and skills by their Key ID fields (eg client number 1(from client table) has skill 1(from skills table), value 23. client number 1 has skill number 4, value 50 and so on)

Is there a single SQL statement that can let me output a list of my clients with their respective skills listed in a "group by" statement ordered by skill (bearing in mind I need to retrieve their details from the client table and the skill name from the skill table)

for example:

high jump
>bill smith 8.3
>ted jones 7.7

Cross country
>fred bloggs 33
>bill smith 30

javelin
>k anon 39

Im sure it can be done but the more I try and think aboot it the more twisted my mind gets... too many festive mince pies and beer!

oh btw i use win 2000 SP1, asp3.0 and SQL server 7.0

cheers,

Robsa"
   

- Advertisement -