-1

下图说明了我的数据库是如何组织的:

一只忙碌的猫 http://akplebani.com/graphic.png

我正在寻找的是一个单一的查询,其结果根据坐标date为我提供了坐标名称、标题项目标题解决方案和名称客户

我正在尝试这样的事情:

SELECT coordinate_name, title_project, title_solution, name_client FROM coordinate NATURAL JOIN client WHERE date BETWEEN ? AND ?
4

1 回答 1

1

确切地确定你想如何定义你的所有联接(即内部联接、外部联接等),但这应该让你开始

SELECT
co.coordinate_name,
cl.name_client,
s.title_solution,
p.title_project
FROM
coordinate AS co
INNER JOIN project AS p ON co.project_id_project = p.id_project
INNER JOIN solution AS s ON p.solution_id_solution = s.id_solution
INNER JOIN client AS cl ON s.client_id_client = cl.id_client
WHERE
co.date BETWEEN ? AND ?
于 2012-11-06T22:27:03.373 回答