gpt4 book ai didi

sql-server - SQL server ERROR 列名不明确

转载 作者:行者123 更新时间:2023-12-05 01:01:54 24 4
gpt4 key购买 nike

无法理解此 SQL 查询中有什么问题:

USE [My_db]
GO

SELECT ItemId
,Subject
,CreatedOn
FROM ItemBase AS e
INNER JOIN ItemExtensionBase AS p
ON e.ItemId = p.ItemId
GO

错误:

 Msg 209, Level 16, State 1, Line 4
Ambiguous column name 'ItemId'.

ItemId 列存在于两个表中。

最佳答案

USE [My_db]
GO

SELECT e.ItemId
,Subject
,CreatedOn
FROM ItemBase AS e
INNER JOIN ItemExtensionBase AS p
ON e.ItemId = p.ItemId
GO

您需要告诉它从哪个表中获取 itemid 字段

关于sql-server - SQL server ERROR 列名不明确,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39106588/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com