I've been trying to join two temp tables but I keep getting an error message saying "Ambiguous column name" even though I used column alias. FYI, this is SQL Server programming.
select ID, count(PageNum) as Frequency
into temp_list
from ID_USA
group by ID
select ID, ISNULL(PageNum1,'') +','+ISNULL(PageNum2,'') +','+ISNULL(PageNum3,'') +','+ISNULL(PageNum4,'') +','+ISNULL(PageNum5,'') As PageNum
from temp_table k
left join temp_list c on c.ID = k.ID
The error message says Ambiguous column name 'ID'.
Could anyone please help? Thanks.