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.
Author |
Topic |
cipriani1984
Constraint Violating Yak Guru
304 Posts |
Posted - 2008-12-10 : 05:37:22
|
Hi,Ive never used a matrix before and im having few problems.I have a table which looks like thisSubject, Week_noMaths, 1Maths, 2Maths, 3How could I use a matrix to show:Subject, Week_no, Week_no, Week_noMaths, 1, 2, 3And there are going to be multiple subjects with different counts, so some rows will show less rows than others, and numbers vary some have; 4 and 25 or 1, 2, 6, 8 etc.Thanks |
|
cipriani1984
Constraint Violating Yak Guru
304 Posts |
Posted - 2008-12-11 : 04:18:31
|
Any ideas anyone?quote: Originally posted by cipriani1984 Hi,Ive never used a matrix before and im having few problems.I have a table which looks like thisSubject, Week_noMaths, 1Maths, 2Maths, 3How could I use a matrix to show:Subject, Week_no, Week_no, Week_noMaths, 1, 2, 3And there are going to be multiple subjects with different counts, so some rows will show less rows than others, and numbers vary some have; 4 and 25 or 1, 2, 6, 8 etc.Thanks
|
 |
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2008-12-11 : 10:37:28
|
just use this as querySELECT Subject,Week_no,ROW_NUMBER() OVER(PARTITION BY Subject ORDER BY Week_no) AS SeqFROM table then use Subject as row group and seq as column group in matrix and use=SUM(Fields!Week_no.value)as expression in data region |
 |
|
|
|
|
|
|