简单连接 sql 不明确的列
simple join sql ambiguous column
我遇到了不明确的列错误?尽管它们与我选择的所有其他列完全相同。
SELECT DISTINCT [date], [problem], [companyprofit], [fixtime]
FROM [fixandresponse] , [netprofit]
WHERE [fixandresponse].[date] = [netprofit].[date]
因为两个table有相同的列名:date.
你可以试试这个:
SELECT DISTINCT [fixandresponse].[date], [problem], [companyprofit], [fixtime]
FROM [fixandresponse] , [netprofit]
WHERE [fixandresponse].[date] = [netprofit].[date]
此外,您应该使用:
SELECT DISTINCT F.[date], F...., N.... -- get column from two table
FROM [fixandresponse] F
INNER JOIN [netprofit] N
ON F.[date] = N.[date]
这样测试
Select distinct f.date, f.problem, f.companyprofit, f.fixtime
from fixandresponse f, netprofit n
Where f.date = n.date
我遇到了不明确的列错误?尽管它们与我选择的所有其他列完全相同。
SELECT DISTINCT [date], [problem], [companyprofit], [fixtime]
FROM [fixandresponse] , [netprofit]
WHERE [fixandresponse].[date] = [netprofit].[date]
因为两个table有相同的列名:date.
你可以试试这个:
SELECT DISTINCT [fixandresponse].[date], [problem], [companyprofit], [fixtime]
FROM [fixandresponse] , [netprofit]
WHERE [fixandresponse].[date] = [netprofit].[date]
此外,您应该使用:
SELECT DISTINCT F.[date], F...., N.... -- get column from two table
FROM [fixandresponse] F
INNER JOIN [netprofit] N
ON F.[date] = N.[date]
这样测试
Select distinct f.date, f.problem, f.companyprofit, f.fixtime
from fixandresponse f, netprofit n
Where f.date = n.date