search

Home  >  Q&A  >  body text

How to update/delete two or more specified pieces of data

How to update/delete two or more specified pieces of data?

I only know that multiple pieces of data with the same conditions can be deleted at the same time. But I don’t know how to delete multiple specified pieces of data at the same time. For example: I want to delete two pieces of data with id=17 and id=16 at the same time. What should I do here?

王先生王先生1898 days ago1272

reply all(2)I'll reply

  • Simine

    Simine2019-11-01 09:27:10

    The above can also be used, or use this

    model('Stus')->where('id', 16)->whereOr('id',17)->delete( );

    reply
    0
  • 卢小强

    卢小强2019-11-01 09:06:12

    Use WHERE condition to delete. The conditions after WHERE can be connected with AND. There can be multiple, such as delete from user where id=1 and id=2 and id=3

    reply
    0
  • Cancelreply