mysql How do I delete multiple data from one table at once?

Asked 2 years ago, Updated 2 years ago, 38 views

tbl_member I'm trying to delete 2 members at the same time from the table, but I keep getting errors I got 2 id values

delete from tbl_member where userid in (user30,user20) or
delete from tbl_member where userid between user30 and user20

How do I delete it correctly?

mysql

2022-09-22 12:29

1 Answers

Write the ID string wrapped in a single quote '.

delete from tbl_member where userid in ('user30','user20')

In the case of programming, it is also okay to batch SQL sentences with different conditions using batch query without creating SQL like above.


2022-09-22 12:29

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.