当前位置: 移动技术网 > IT编程>数据库>Mysql > mysql多表联合查询返回一张表的内容实现代码

mysql多表联合查询返回一张表的内容实现代码

2017年12月12日  | 移动技术网IT编程  | 我要评论
今天在使用mysql语句的时候老是报错,语句如下:
sql代码
复制代码 代码如下:

select sapcle from sellenterprisebaseinfor sebie,sellenterprisebaseinforver sebive,sellapplypermitchangelist sapcle
where 1=1 and sebie.iverid = sebive.id and sapcle.ienterprisebaseinforid=sebive.id and sapcle.istate=1 and sapcle.ienterpriseid=11027516 and sapcle.id=84

在consol控制台,查询到hibernate打印出来的sql语句,拿到mysql里面查询的时候老是报错,提示unknown column 'sapcle' in 'field list',按照后面定义的 sellapplypermitchangelist sapcle应该已经没问题了,问了同事才发现,在java语句里面可以这么写,但是在mysql编辑器里面使用的时候要改成

sql代码
复制代码 代码如下:

select sapcle.* from sellenterprisebaseinfor sebie,sellenterprisebaseinforver sebive,sellapplypermitchangelist sapcle
here 1=1 and sebie.iverid = sebive.id and sapcle.ienterprisebaseinforid=sebive.id and sapcle.istate=1 and sapcle.ienterpriseid=11027516 and sapcle.id=84

如对本文有疑问, 点击进行留言回复!!

相关文章:

验证码:
移动技术网