zl程序教程

您现在的位置是:首页 >  数据库

当前栏目

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

mysql代码 实现 查询 内容 返回 联合 多表
2023-06-13 09:14:42 时间
今天在使用mysql语句的时候老是报错,语句如下:
Sql代码
复制代码代码如下:

SELECTsapcleFROMSellEnterpriseBaseInforsebie,SellEnterpriseBaseInforVersebive,SellApplyPermitChangeListsapcle
WHERE1=1ANDsebie.iVerID=sebive.idANDsapcle.iEnterpriseBaseInforID=sebive.idANDsapcle.iState=1ANDsapcle.iEnterpriseID=11027516ANDsapcle.id=84

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

Sql代码
复制代码代码如下:

SELECTsapcle.*FROMSellEnterpriseBaseInforsebie,SellEnterpriseBaseInforVersebive,SellApplyPermitChangeListsapcle
HERE1=1ANDsebie.iVerID=sebive.idANDsapcle.iEnterpriseBaseInforID=sebive.idANDsapcle.iState=1ANDsapcle.iEnterpriseID=11027516ANDsapcle.id=84