Sunday, 15 January 2012

sql - How to copy one row item to another row -



sql - How to copy one row item to another row -

i have next table:

student_id description 1 0x 2 0x1g800.... 3 0x1f800....

student_id 1 has empty value how can re-create student_id 2's value in 1 using sql query.

is you're looking for?

update pupil set description = (select description pupil student_id = 2) student_id = 1

or using join:

update s set s.description = s2.description pupil s bring together pupil s2 on s2.student_id = 2 s.student_id = 1

good luck.

sql sql-server-2008

No comments:

Post a Comment