Relative Content

Tag Archive for sqlmysql

Delete record and update default column to zero if one

I want virtual delete one item in database , when (id = 2 And productId = 1 and deleted=0) . this query change row id 2 and set deleted column to one, it means row deleted and if this row is default then change to default=0 (that mean this row not default row) and random select another row d product=1 set default column to one. this query work correctly. but when i have only one row of productId = 1 this query not work because needs min two rows of productId = 1 and deleted=0.

Delete record and update default column to zero if one

I want virtual delete one item in database , when (id = 2 And productId = 1 and deleted=0) . this query change row id 2 and set deleted column to one, it means row deleted and if this row is default then change to default=0 (that mean this row not default row) and random select another row d product=1 set default column to one. this query work correctly. but when i have only one row of productId = 1 this query not work because needs min two rows of productId = 1 and deleted=0.

Delete record and update default column to zero if one

I want virtual delete one item in database , when (id = 2 And productId = 1 and deleted=0) . this query change row id 2 and set deleted column to one, it means row deleted and if this row is default then change to default=0 (that mean this row not default row) and random select another row d product=1 set default column to one. this query work correctly. but when i have only one row of productId = 1 this query not work because needs min two rows of productId = 1 and deleted=0.

Delete record and update default column to zero if one

I want virtual delete one item in database , when (id = 2 And productId = 1 and deleted=0) . this query change row id 2 and set deleted column to one, it means row deleted and if this row is default then change to default=0 (that mean this row not default row) and random select another row d product=1 set default column to one. this query work correctly. but when i have only one row of productId = 1 this query not work because needs min two rows of productId = 1 and deleted=0.