0

出于某种原因,我的 INNER JOIN 有问题,它根本不起作用。

这是我的代码

SELECT
    `hold`.`id` AS `id`,
`hold`.`name` AS `name`
INNER JOIN `instruktorer`
ON `hold`.`ins` = `instruktorer`.`id`
FROM `hold`

我得到的错误是:

You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'INNER JOIN `instruktorer` ON `hold`.`ins` = `instruktorer`.`id` FROM `hold`' at line 4

我几乎每天都进行一次 INNER JOIN,但现在我无法让它工作。

希望可以有人帮帮我

4

3 回答 3

3

试试这个:

SELECT
    `hold`.`id` AS `id`,
`hold`.`name` AS `name`
FROM `hold`
INNER JOIN `instruktorer`
ON `hold`.`ins` = `instruktorer`.`id`
于 2013-01-11T10:46:02.220 回答
1

FROM必须来之前INNER JOIN。通常,所有查询都有一个定义的顺序。对于 SELECT 它是这样的

select
from
join
where
group by
having
order by 
limit
于 2013-01-11T10:46:35.543 回答
1

JOIN的写法不正确。它应该如下
SELECT 'column_name' ..... FROM 'table1' JOIN TYPE 'table2' ON SOME CONDITION

请在此处检查基础知识。

于 2013-01-11T10:52:53.193 回答