Home > Database > Mysql Tutorial > body text

mysql多表联合查询如何返回一张表的内容_MySQL

WBOY
Release: 2016-06-01 13:38:14
Original
847 people have browsed it

bitsCN.com


mysql多表联合查询如何返回一张表的内容

 

今天在使用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 
 

bitsCN.com
Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template