删除查询在mysql中不起作用 [英] Delete query not working in mysql

查看:50
本文介绍了删除查询在mysql中不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试从名为 user_enrole 的表中删除所有记录.我正在使用此查询

I am trying to delete all records from a table called user_enrole.I am using this query

DELETE * FROM user_enrole

我认为我的查询语法没有错,但它给了我错误说

I think syntax of my query is not wrong but it is giving me error saying

#1064 - 您的 SQL 语法有错误;检查与您的 MySQL 服务器版本相对应的手册以了解要使用的正确语法在第 1 行的* FROM user_enrole"附近

#1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '* FROM user_enrole' at line 1

我已经仔细检查了我的语法,我无法弄清楚出了什么问题,请有人指出.

I have doubled check my syntax i am not able to figure out what is going wrong can someone point out please.

是因为这个表与使用表的关系还是什么?

Is it occuring because of the relationship this table has with use table or what?

推荐答案

您不需要在删除中使用星号.只需执行 DELETE FROM user_enrole 即可删除所有记录.

You don't need to use the asterisk in a delete. Just do DELETE FROM user_enrole to delete all records.

如果你想删除由一个或多个条件过滤的特定记录,你将在WHERE子句中指定这些条件,如下所示:

If you want to delete specific records filtered by one or more conditions, you will specify those conditions in the WHERE clause, like so:

DELETE FROM user_enrole
WHERE somecolumn > 1
AND anothercolumn = 'Username'

这篇关于删除查询在mysql中不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆