我有这样的查询
SELECT DISTINCT
[fldID],
[fldValue]
FROM
(
(
SELECT
alias1.[fldID],
alias1.[fldValue]
FROM someT as alias1
....
)
) AS subQuery_1
INNER JOIN
(
SELECT
alias1.[fldID],
alias1.[fldValue]
FROM someT as alias1
...
) AS subQuery_2 USING( fldID, fldValue)
它在 MySQL 中运行良好,但 SQL Server 不支持 USING。所以我必须像这样使用 JOIN :
ON [subQuery_1].[fldID] = [subQuery_2].[fldID]
AND [subQuery_1].[fldValue] = [subQuery_2].[fldValue]
但是这个查询会导致错误:
Ambiguous column name fldID
Ambiguous column name fldValue
那么,如何在 SQL Server 中实现这种 JOIN 呢?