在 mariadb 中进行连接查询的正确方法是什么?
What is the proper way to make a join query in mariadb?
我在数据库中有两个 table,companies 和 line_of_business,我想要从 table companies 中获取所有数据以及 table [=] 中的 line_of_business 列27=]type_of_business.
这是 table 公司的字段:
id,
company,
address,
city,
tel_number,
fax_number,
line_of_business(FRK)
这是 table line_of_business 的字段:
id,
type_of_business,
description
我尝试使用此处的引用对数据库进行查询。 http://www.w3schools.com/sql/sql_join_inner.asp,但结果是 #1054 - Unknown column 'companies.company' in 'field list',
,在 table companies
中存在公司列
这是我的查询,
SELECT `companies.id`, `companies.company`, `companies.address`, `companies.city`, `companies.tel_number`, `companies.fax_number`, `companies.tax_number`, `line_of_business.type_of_business` FROM `companies` INNER JOIN `line_of_business` ON `line_of_business.id`=`companies.line_of_business`
知道进行连接查询的正确方法吗?
您可以对所有列
使用 companies
.company
而不是 companies.company
我在数据库中有两个 table,companies 和 line_of_business,我想要从 table companies 中获取所有数据以及 table [=] 中的 line_of_business 列27=]type_of_business.
这是 table 公司的字段:
id,
company,
address,
city,
tel_number,
fax_number,
line_of_business(FRK)
这是 table line_of_business 的字段:
id,
type_of_business,
description
我尝试使用此处的引用对数据库进行查询。 http://www.w3schools.com/sql/sql_join_inner.asp,但结果是 #1054 - Unknown column 'companies.company' in 'field list',
,在 table companies
这是我的查询,
SELECT `companies.id`, `companies.company`, `companies.address`, `companies.city`, `companies.tel_number`, `companies.fax_number`, `companies.tax_number`, `line_of_business.type_of_business` FROM `companies` INNER JOIN `line_of_business` ON `line_of_business.id`=`companies.line_of_business`
知道进行连接查询的正确方法吗?
您可以对所有列
使用companies
.company
而不是 companies.company