Home > Database > Mysql Tutorial > body text

mysql-Mysql combined query statement problem

WBOY
Release: 2016-11-30 23:59:59
Original
1412 people have browsed it

mysql

I have such a query:
SELECT * FROM WaferInfo
LEFT JOIN LotInfoDef ON WaferInfo.LotSerialID = LotInfoDef.LotSerialID
LEFT JOIN ProducInfotDef ON WaferInfo.DeviceSerialID = ProducInfotDef.DeviceSerialID
LE FT JOIN RoleDef ON WaferInfo.TestOperator = RoleDef .RoleID
LEFT JOIN WaferData ON WaferInfo.WaferSerialID = WaferData.WaferSerialID WHERE DieType ='MPC' GROUP BY WaferID,DieType
I found a very strange problem while doing it. The conditions behind the last WHERE statement cannot be defined according to my own needs. , it can only use the WaferID and DieType information behind the Where condition Group by. Is there any way to solve this problem? Also, can the current result set continue to be queried using select, such as select (select...)

Reply content:

For multi-table queries, it is best to add the indication in front of these two fields, WaferID and DieType (recommendation). It is possible that this field exists in several tables,,, and you cannot tell which table these two fields belong to from the above.
My guess is that in WaferInfo, you want to find the DieType field in this table as mpc, and you only want to get two fields, WaferID and DieType? ? , why do you need to join so many tables? ?
Please tell me your needs and if it is convenient, take a screenshot of the relevant table structure

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
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!