I am trying to combine two tables with same columns in SQL Server.
Individually, my queries work fine:
Select
_NAME, COUNT(_NAME) as Occurrences
From
SP6815_NOK
Where
_VALUE = 1
Group By
_NAME
Order By
Occurrences desc
and
Select
_NAME, COUNT(_NAME) as Occurrences
From
SP6814_NOK
Where
_VALUE = 1
Group By
_NAME
Order By
Occurrences desc
Resulting in:
and
I need the query to perform the exact filters as listed in my individual queries but every time I try a 'join' clause or simply listing both tables under the 'from' statement, I get an ambiguous column error.
I think it might be because some of the messages or "_NAMES" are shared by both tables, but I still need it to count up the occurrences and not overwrite them. Could anyone help?