Permalink
Switch branches/tags
Nothing to show
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
13 lines (13 sloc) 270 Bytes
SELECT o.customerkey
,o.IncomeGroup
,o.Region
,i.Model
,count(i.Model) as FreqBuy
from [dbo].[vAssocSeqOrders] o join [dbo].[vAssocSeqLineItems] i
on o.OrderNumber = i.OrderNumber
group by
i.Model,
o.CustomerKey,
o.IncomeGroup,
o.Region
order by FreqBuy desc