PHP MySQL where how to delete multiple IDs?

Source: Internet
Author: User
Title
Deleting multiple databases is generally where id=1 or id=2 or id=3 ...
However the deletion ID is assembled with a number of my practice is always deleted
Is there a simple way to do this is not to traverse delete?
Also in contains, not in does not contain, between in range, not between out of range
What do these four mean?

Reply content:

Title
Deleting multiple databases is generally where id=1 or id=2 or id=3 ...
However the deletion ID is assembled with a number of my practice is always deleted
Is there a simple way to do this is not to traverse delete?
Also in contains, not in does not contain, between in range, not between out of range
What do these four mean?

In (1,2,3,4), that is, all of the brackets inside are in accordance with
Not in (5,6,7,8), is the parentheses inside of all non-conforming
Between 9 and 12, that is 9-12 (9,10,11,12) in this range all meet
Not between and 15, is 12-15 (12,13,14,15) in this range all does not meet

The simplest one, write it over and see the results.

You delete more than one, since it is an array of packages, you can turn the comma-delimited string into in.

Delete from table where ID in (2,3) #id为1,
Delete from table where ID not in (2,3) #除1, all records except

Delete from table where ID between 1 and 5 #id为1-3
Delete from table where ID not between 1 and 5 #除1-5 All records

Delete from table where ID in (All-in))

Turn your array into a "one-of-a-round" string

  • Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.