英文:
Why am i getting "relation does not exist" when it does?
问题
我在尝试使用以下查询填充我的表时遇到了错误:
INSERT INTO d_table
SELECT category.name, film_category.film_id
FROM category
INNER JOIN film_category ON film_category.category_id = category.category_id
它返回一个错误
"关系 film_category.film_id 不存在"
这是数据库中的表:
category
category_id
name
film_category
film_id
category_id
需要在表中使用这两个字段。
英文:
I'm getting an error while attempting to populate my table with the following query:
INSERT INTO d_table
SELECT category.name, film_category.film_id
FROM category
INNER JOIN film_category.film_id ON film_category.category_id = category.category_id
It returns an error
> "relation film_category.film_id does not exist"
These are the tables in the database:
**category**
category_id
name
**film_category**
film_id
category_id
Need both fields in table.
答案1
得分: 2
你的INNER JOIN似乎不正确。您没有指定关系,而是列。我认为您想要
INSERT INTO d_table
SELECT
category.name, film_category.film_id
FROM category
INNER JOIN film_category
ON film_category.category_id = category.category_id
英文:
Your INNER JOIN doesn't appear to be correct. You aren't specifying a relation, but a column. I think you wanted
INSERT INTO d_table
SELECT
category.name, film_category.film_id
FROM category
INNER JOIN film_category
ON film_category.category_id = category.category_id
答案2
得分: 0
因为你的FROM子句中没有关系film_category
。
英文:
Because you don't have relation film_category
in your from clause
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论