Aggregate the Data
Posted: Thu Jun 10, 2010 2:33 pm
HI,
I have a data
Stud Subject1 Subject2 Subject 3 Subject4
a1 Null Null 10 Null
a1 Null 5 Null Null
a1 Null Null Null Null
a1 Null Null Null Null
I want an output like
Stud Subject1 Subject2 Subject 3 Subject4
a1 Null 5 10 Null
To acheive it, used an aggregate function,group by Stud and used Max function and got the results like
Stud Subject1 Subject2 Subject 3 Subject4
a1 0 5 10 0
For Subject 2 ad 3, it is OK but for Suject 1 and Subject4, Insead of Null, I am getting 0. The data type is Small int.
Please let me know how can I get the expected results.
Regards
Neeraj
I have a data
Stud Subject1 Subject2 Subject 3 Subject4
a1 Null Null 10 Null
a1 Null 5 Null Null
a1 Null Null Null Null
a1 Null Null Null Null
I want an output like
Stud Subject1 Subject2 Subject 3 Subject4
a1 Null 5 10 Null
To acheive it, used an aggregate function,group by Stud and used Max function and got the results like
Stud Subject1 Subject2 Subject 3 Subject4
a1 0 5 10 0
For Subject 2 ad 3, it is OK but for Suject 1 and Subject4, Insead of Null, I am getting 0. The data type is Small int.
Please let me know how can I get the expected results.
Regards
Neeraj