如何将此访问查询转换为mySQL查询 [英] How do I convert this Access Query to mySQL query

查看:60
本文介绍了如何将此访问查询转换为mySQL查询的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

此问题是以下问题的继续: 如何将此访问查询转换为mySQL查询?

This question is continuation of the following question: How do I convert this Access Query to mySQL query?

我想在我的代码中将以上内容表示如下:

I want to represent the above in my code as follows:

Access SQL FROM语句如下

the Access SQL FROM statement is as below

FROM qryvw_employees 
INNER JOIN ((Tbl_Clients INNER JOIN (Tbl_Assignments 
INNER JOIN Tbl_Tasks ON Tbl_Assignments.Assignment_ID = Tbl_Tasks.Assignment_ID) ON Tbl_Clients.PAN = Tbl_Assignments.PAN) 
INNER JOIN qryvw_subtasks ON Tbl_Tasks.TaskID = qryvw_subtasks.TaskID) ON qryvw_employees.ID = Tbl_Tasks.Assigned_To

基于此查询中的回复,我正在尝试以下操作:

Based on the reply in this query I am trying this:

FROM 
qryvw_employees
INNER JOIN (tbl_clients 
INNER JOIN tbl_assignments ON tbl_clients.`PAN` = tbl_assignments.`PAN`
INNER JOIN tbl_tasks ON tbl_assignments.`Assignment_ID` = tbl_tasks.`Assignment_ID`
INNER JOIN qryvw_subtasks ON tbl_tasks.`TaskID` = qryvw_subtasks.`TaskID`) ON qryvw_employees.`ID` = tbl_tasks.`Assigned_To`

我试图实现的上述关系图如下: 在此处输入图片描述

The diagram of the above relationship that I am trying to achieve is as follows: enter image description here

plz协助,请勿在信誉低下删除.这是真正正确的疑问,因为两个表之间存在一对多的关系,而以上问题未涵盖该问题.

plz assist, do not delete on the basis of low reputation. this is genuinely proper doubt since two tables have a one to many relationship and this is not covered in the above question.

我的问题是我如何在SQL语句中表示两个一对多的关系(如图所示).这是如何将此访问查询转换为mySQL查询的延续.上面的链接.

My question is how do i represent the two one to many relationship (as shown in diagram) in the SQL statement. This is continuation to the How do I convert this Access Query to mySQL query? link above.

推荐答案

当语句由Access iteself生成时,该查询在MySQL中有效.无需更改.这是下面的答案:

The query works in MySQL when the statement is as generated by Access iteself. No change required. Here is the answer below:

FROM 
qryvw_employees
INNER JOIN (tbl_clients 
INNER JOIN tbl_assignments ON tbl_clients.`PAN` = tbl_assignments.`PAN`
INNER JOIN tbl_tasks ON tbl_assignments.`Assignment_ID` = tbl_tasks.`Assignment_ID`
INNER JOIN qryvw_subtasks ON tbl_tasks.`TaskID` = qryvw_subtasks.`TaskID`) ON qryvw_employees.`ID` = tbl_tasks.`Assigned_To`

这篇关于如何将此访问查询转换为mySQL查询的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆