sql语句 异常 Err] 1064 – You have an error in your SQL syntax; check the manual that corresponds to your

sql语句 异常 Err] 1064 – You have an error in your SQL syntax; check the manual that corresponds to your在我们开发的工程中,有时候会报[Err]1064-YouhaveanerrorinyourSQLsyntax;checkthemanualthatcorrespondstoyourMySQLserverversionfortherightsyntaxtousenear——这种异常不用多想,肯定是我们的sql语句出现问题,下面…

大家好,又见面了,我是你们的朋友全栈君。

在我们开发的工程中,有时候会报
[Err] 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 ——
这种异常 不用多想,肯定是我们的sql语句出现问题,下面我只说我经常犯的一种错误。当然还有很多种错误,我们遇到再说。
在这里插入图片描述
这时候 我们不难发现 错误的原因是我们这里多了一个 ,号

有时候也会出现这种错误 [Err] 1054 – Unknown column ‘———-’ in ‘field list’
在这里插入图片描述
这时候是我们的字段写错了 我们会发现数据库中并没有这个字段 而是我们的字段写错了

下面为大家写上两个同级sql

select a.Attribute_Id as Attribute_Id,          
       a.Attribute_Name as Attribute_Name,      
       a.Attribute_Alias as Attribute_Alias,
       a.Attribute_Unit as Attribute_Unit,
       a.DeviceType_Id as DeviceType_Id,
       a.SortCode as SortCode,
       a.UpdateTime as UpdateTime,   
       a.isdel as isDel
			from  zz_deviceattribute as a
where   Attribute_Id in(
select Attribute_Id from ZZ_DeviceAttributeRelation
where Device_Id =  '05871a37-a242-40f9-bbea-33bdea7009d5')
 select distinct 
 				a.Attribute_Id as Attribute_Id,
				a.Attribute_Name as Attribute_Name,
				a.Attribute_Alias as Attribute_Alias,
				a.Attribute_Unit as Attribute_Unit,
				a.DeviceType_Id as DeviceType_Id,
				a.SortCode as SortCode,
				a.UpdateTime as UpdateTime,   
				a.isdel as isDel        
		from ZZ_DeviceAttributeRelation  as b
				inner join zz_deviceattribute as a 
				on a.Attribute_Id = b.Attribute_Id
				where b.Device_Id =  '05871a37-a242-40f9-bbea-33bdea7009d5'
				and a.isDel ='0'
				order by a.SortCode

在这里插入图片描述
欢迎大家加入技术群聊

版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请联系我们举报,一经查实,本站将立刻删除。

发布者:全栈程序员-站长,转载请注明出处:https://javaforall.net/130032.html原文链接:https://javaforall.net

(0)
全栈程序员-站长的头像全栈程序员-站长


相关推荐

  • python怎么表示取余_python如何实现取余操作[通俗易懂]

    python怎么表示取余_python如何实现取余操作[通俗易懂]python实现取余操作的方法:可以利用求模运算符(%)来实现。求模运算符可以将两个数相除得到其余数。我们还可以使用divmod()函数来实现取余操作,具体方法如:【divmod(10,3)】。在python中要实现取余操作可以使用求模运算符(%),该运算符可以将两个数相除得到其余数。(推荐教程:Python入门教程)如果一个数恰好能被另外一个数据整除,则余数为0,%运算后返回结果为0。可利用余数…

    2022年4月25日
    76
  • Antd的table筛选,表头columns的filters过滤清空

    Antd的table筛选,表头columns的filters过滤清空Form+Table实现了自定义筛选菜单的功能。具体可以参考https://ant.design/components/table-cn/#components-table-demo-custom-filter-panel。但是此功能会有bug:选择相应的搜索条件后,点击“搜索”按钮,Table会渲染相应的数据,且Table表头也有自带的过滤功能(实际上是column的filters属性起的作用);然后再点击“清除”按钮,所有的搜索条件和表头里filters过滤的条件都要被清除。但是Ta.

    2022年5月21日
    49
  • FIREBIRD使用经验总结

    FIREBIRD使用经验总结

    2021年7月30日
    65
  • p6使用说明_人员配置情况说明

    p6使用说明_人员配置情况说明P6SPY 是一个监控JDBC执行语句的开源产品,利用P6SPY很容易的就能监控到JDBC中执行的SQL语句,便于系统调试和性能调优。P6SPY 实现原理是对JDBC的关键类进行了一次包装,让应用系统调用自己的类;自己的类截获到SQL语句后再调用真实的JDBC驱动进行执行SQL,这样,在自己的类里面就可以监控到所有的SQL语句。    P6SPY 使用非常简单,只需要简单的几步即完成配置:

    2022年10月5日
    3
  • HttpClient4.x 文件上传

    HttpClient4.x 文件上传演示gradle包引入compilegroup:’org.apache.httpcomponents’,name:’httpclient’,version:’4.5.3’上传HttpClientHTTP_CLIENT=HttpClients.createDefault();HttpPosthttpPost=newHttpPost(“http://localhost/fi

    2022年7月22日
    9
  • QAS传输

    QAS传输 *StartSTMS   *Usethemenu”Extras-otherrequests-Add”   *enterthetransportnumberandclickthe”Importagain”buttonNowyoucanre-importtherequest. 

    2022年6月28日
    37

发表回复

您的邮箱地址不会被公开。 必填项已用 * 标注

关注全栈程序员社区公众号