-1

in mysql In a single table i want to delete particular row and remaining row must be comes in place of that particular row along with id... How can i do this??

Id  Name             Title                 order_id     Delete
------------------------------------------------------------------
134 ravi luhar       asp.net developer     1            DELETE
135 ravi luhar       asp.net developer     2            DELETE
John Woo
  • 258,903
  • 69
  • 498
  • 492
vjy
  • 1
  • So you want ID 135 to become 134? and 134 to be deleted? – Kyle Mar 04 '13 at 06:23
  • yes... the entire row must be deleted and another remaing row must be go up... in short i want to use the concept of up and down the row in mysql... how can id o..??? can you help?? – vjy Mar 04 '13 at 07:04
  • Duplicate: http://stackoverflow.com/q/1841104/1563422 Read the answers there, there's already some very good answers... no point duplicating them here. – Danny Beckett Mar 04 '13 at 07:18

1 Answers1

0

you can process with 2 query. first copy & update 1st row data and then delete second row data.

UPDATE users AS A
      LEFT JOIN users AS B ON B.id = 135
SET A.name = B.name 
     WHERE A.id = 134;

Delete from users where id=135;
CharlesB
  • 86,532
  • 28
  • 194
  • 218
satish-a
  • 1
  • 1