I should find out the dates of each customers' LAST orders.
select
Dimension.Customer.[Primary Contact],
Fact.Sale.[Invoice Date Key],
cast(Fact.sale.[Invoice Date Key] as nvarchar) as castt
from
Dimension.Customer
inner join
Fact.Sale on Dimension.Customer.[Customer Key]= Fact.Sale.[Customer Key]
group by
Dimension.Customer.[Primary Contact], Fact.sale.[Invoice Date Key]
order by
Dimension.Customer.[Primary Contact]
But instead I get this message :
Conversion failed when converting the nvarchar value 'Unknown' to data type int
What am I doing wrong?