-2

I'm getting an ambiguous column error? Even though they are exactly the same like all the other columns that I selected.

SELECT DISTINCT [date], [problem], [companyprofit], [fixtime]
FROM [fixandresponse]  , [netprofit] 
WHERE [fixandresponse].[date] = [netprofit].[date]
ZekeDroid
  • 7,089
  • 5
  • 33
  • 59

2 Answers2

0

Because two table have a same column name: date.

You can try this:

SELECT DISTINCT [fixandresponse].[date], [problem], [companyprofit], [fixtime]
FROM [fixandresponse]  , [netprofit] 
WHERE [fixandresponse].[date] = [netprofit].[date]

Also, you should use:

SELECT DISTINCT F.[date], F...., N.... -- get column from two table
FROM [fixandresponse] F
  INNER JOIN [netprofit] N
    ON F.[date] = N.[date]
Nguyễn Hải Triều
  • 1,454
  • 1
  • 8
  • 14
0

Thus Test

Select distinct f.date, f.problem, f.companyprofit, f.fixtime    
from fixandresponse f, netprofit n    
Where f.date = n.date
HaveNoDisplayName
  • 8,291
  • 106
  • 37
  • 47