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)
全栈程序员-站长的头像全栈程序员-站长


相关推荐

  • 正交矩阵的模_正交矩阵的向量组

    正交矩阵的模_正交矩阵的向量组本节主要讲解正交(orthogonal)概念对于向量、基和子空间的意义。1.正交向量Orthogonalvectors2.正交子空间Orthogonalsubspaces3.零空间与行空间正交Nullspaceisperpendiculartorowspace4.矩阵A^TA

    2025年8月23日
    3
  • java 音频转为wav格式标准音频 | Java工具类

    java 音频转为wav格式标准音频 | Java工具类目录简述环境依赖maven依赖ffmpeg依赖工具类代码总结简述该工具类主要是为了将各类音频转为wav标准格式,其中可以调节采样率、声道数等指标。主要是使用ffmpeg命令进行转换。环境依赖maven依赖<dependency><groupId>org.bytedeco</groupId><artifactId>javacv-platfor

    2022年6月20日
    27
  • linux工具箱_docker ps命令

    linux工具箱_docker ps命令1.gdb调试利器GDB是一个由GNU开源组织发布的、UNIX/LINUX操作系统下的、基于命令行的、功能强大的程序调试工具。对于一名Linux下工作的c++程序员,gdb是必不可少的工具;1.1.启动gdb对C/C++程序的调试,需要在编译前就加上-g选项:$g++-ghello.cpp-ohello调试可执行文件:$gdbprogram也就是你的执行文件,一般在当前目录下。调试core文件(core是程序非法执行后coredump后产生的文件):$gdb$gdb

    2025年11月15日
    3
  • Win10 删除默认共享文件夹

    在CMD下删除默认共享文件可能很多人都遇到过此问题,新买的笔记本安装了Win10系统,按照激活的顺序没有administrator账户,系统内只有自己设置的账号。而且,你在cmd或者计算机管理内里进行一些操作时都显示无权限或者拒绝访问。尤其是想关闭掉默认共享的时候,无法完成。解决方法很简单,我们用管理员进入CMD:在运行对话框内输入CMD后,先不要立即回车进入,按住CTRL+SHIFT+EN…

    2022年4月13日
    394
  • Mysql 事物语法

    Mysql 事物语法

    2022年3月4日
    41

发表回复

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

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