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 |
|
bhaasjoshi
Starting Member
17 Posts |
Posted - 2010-06-18 : 02:00:17
|
| Hi friends,I have the following table,ID Grade Var11 4 1 3 1 2 1 1 83_______________________2 4 2 3 152 2 82 1 _______________________3 4 3 3 83 2 3 1 ________________________4 4 244 3 4 2 104 1I need to populate some values based on the following logic,(1) For ID 1, Grade 1 is the minimum grade so no values for VAR1 in higher grades(2,3,4) can be NULL (it is already like that).(2) For ID 2, Grade 1 needs values in VAR1 from the immediate higher grade i.e. Grade 2. Grade 4 can be null.(3) For ID 3, The values from Grade 3 need to be populated in Grades 2 and 1 (lower grades which are null).(4) For ID 4, The value of Grade 3 should be the value of the immediate higher grade i.e. grade 4, and similarly the value of Grade 1 should be the value of the immediate higher grade i.e. grade 2.The final expected output is as following,ID Grade Var11 4 1 3 1 2 1 1 83________________________2 4 2 3 152 2 82 1 8_______________________3 4 3 3 83 2 83 1 8_________________________4 4 244 3 244 2 104 1 10Please help, the application which I am using is called Integrated Review and has its own limitations, but if I could atleast get an easy logic to follow it would be great.Thanks,BJ |
|
|
|
|
|
|
|