Kyrilluk (12/15/2015)
Excellent article, thank you.For those of you that just hate creating views or would like to keep experimenting with different sql queries and have windows connection rather than a SQL ones, the following my help:
SQLconnection<-odbcDriverConnect("Driver=SQL Server; Server=MyDummyInstance\\BI_DEV; Database=AdventureWorksDW2012; trusted_connection=true;")
salesData<- sqlQuery(SQLconnection, "
select
sales.ProductKey,
p.ProductSubcategoryKey,
ps.EnglishProductSubcategoryName,
p.EnglishProductName,
sales.SalesTerritoryKey,
t.SalesTerritoryRegion,
sales.CustomerKey
from dbo.FactInternetSales as sales
inner join dbo.DimProduct as p on p.ProductKey = sales.ProductKey
inner join dbo.DimProductSubcategory as ps on ps.ProductSubcategoryKey = p.ProductSubcategoryKey
inner join dbo.DimSalesTerritory as t on t.SalesTerritoryKey = sales.SalesTerritoryKey;
")
odbcClose(SQLconnection)
Very nice - thank you for adding that 🙂
Cheers,
Nick