SQL 连接使用 USING:<列名>不是公认的表格提示选项 [英] SQL join using USING: &lt;column name&gt; is not a recognized table hints option

查看:31
本文介绍了SQL 连接使用 USING:<列名>不是公认的表格提示选项的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有以下加入:

SELECT * FROM tableA INNER JOIN tableB USING (commonColumn)

我收到一个错误:

<块引用>

"commonColumn" 不是可识别的表提示选项.如果是旨在作为表值函数的参数或CHANGETABLE 函数,确保你的数据库兼容模式是设置为 90.

以下方法有效:

SELECT * FROM tableA INNER JOIN tableB ON tableA.commonColumn = tableB.commonColumn

在我的情况下,兼容性级别设置为 100 (SQL Server 2008),而顺便说一下,我使用的是 SQL Server 2012.

我做错了什么?我发现很难找到使用关键字 USING 的示例,因为几乎不可能进行相关的网络搜索.然而,当连接列"具有相同名称时,使用它似乎是正确的......

解决方案

USING 关键字用于指定 MERGE 语句(称为 <table source>) 在文档中.>

I have the following JOIN:

SELECT * FROM tableA INNER JOIN tableB USING (commonColumn)

I get an error:

"commonColumn" is not a recognized table hints option. If it is intended as a parameter to a table-valued function or to the CHANGETABLE function, ensure that your database compatibility mode is set to 90.

The following instead works:

SELECT * FROM tableA INNER JOIN tableB ON tableA.commonColumn = tableB.commonColumn

The compatibility level in my case is set to 100 (SQL Server 2008), while, by the way, I am working with SQL Server 2012.

What am I doing wrong? I find it very difficult to find example of the use of the keyword USING, as it is almost impossible to do a relevant web search. Yet, it seems the right thing to use when the "joining columns" have the same name...

解决方案

The USING keyword is used to specify the source data for MERGE statements (called <table source>) in the documentation.

这篇关于SQL 连接使用 USING:<列名>不是公认的表格提示选项的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆