Need_help_in_an_update_query

hi
i have a requirement, wherein i have to update records in such a way that each student's marks are copied in a new column of the next student record.
can anybody help me with it please
regards
~aamir

Your query will always set NULL values to New_mark as where condition never met and you always get NULL from sub query.....However,here one of the solution with co-related quries...
        UPDATE emp t
          SET new_marks = (SELECT marks FROM emp e WHERE e.id=t.id-1) ;
Output
ID     NAME     MARKS     NEW_MARKS
1     imran     5     
2     bilal     10     5
3     sajjad     15     10
4     sameer     20     15hope it helps..
Edited by: imkhan on Oct 22, 2012 4:13 PM

Similar Messages

Maybe you are looking for