SQL complex query

I have a Census project with more than 3000 questionnaires divided in multiple tables, 6 exactly plus a master table.

I would like now to export my census as a single table. I did this script before, but unfortunatly lost it.
Maybe a Cube wor Rollup would do it ?
Of course, finally I can do something with .Net, but I just wonder if anybody know the answer with SQL.

Each table (B to G) have this structure:

Id_entry Id_q Answer
4 B118 1
4 B119 False
4 B120 9


The master table Entry has this structure:

Id_entry School_roll Date_entry
4 RETFSD 10/02/2003
5 LKIOM 10/02/2003
6 JKLEOI 10/02/2003

So what I need is something like that:

School_roll B118 B119 B120
RETFSD 1 False 9
LKIOM 2 False 7
JKLEOI 1 True 4

Obviously the key is Id_entry  for each table and I would like to have each question as a header.

No Comments