G
Guest
Hello,
I am stumped, I think using the Top values query I should be able to pull a
query that will list a Customer, as well as the Top three Types of Orders (we
call them styles) they have ordered as well as how many times each was
ordered.
I am trying to use the method provided on this KB
http://support.microsoft.com/kb/q153747/ but maybe it won't work in this
situation.
What I have is two queries , that are listed below, can anybody tell me if
this is possbile, I have tried every combination I can think of and the query
only pulls the Top 3 Values, regardless of Customer.
aaaaaqryGetTop3Styles:
SELECT tblOrders.CustomerID, tblOrders.PGStyle, Count(tblOrders.PGStyle) AS
CountOfPGStyle
FROM tblOrders, tblTempFilterQueries
WHERE (((tblOrders.OrderConfirmDate) Between [TempFilterstartdate] And
[TempFilterEndDate]))
GROUP BY tblOrders.CustomerID, tblOrders.PGStyle
ORDER BY Count(tblOrders.PGStyle) DESC;
And then aaaaaqryTop3Dealer to pull the values by each Customer:
SELECT tblCustomers.CustomerID, aaaaaqryGetTop3Styles.CountOfPGStyle,
aaaaaqryGetTop3Styles.PGStyle
FROM tblCustomers INNER JOIN aaaaaqryGetTop3Styles ON
tblCustomers.CustomerID = aaaaaqryGetTop3Styles.CustomerID
WHERE (((aaaaaqryGetTop3Styles.CountOfPGStyle) In (Select Top 3
[CountOfPGStyle] From aaaaaqryGetTop3Styles Where
[aaaaaqryGetTop3Styles].[CustomerID]=[CustomerID] Order By [CountOfPGStyle]
DESC)))
ORDER BY tblCustomers.CustomerID, aaaaaqryGetTop3Styles.CountOfPGStyle;
Thanks for any assitance, Rick.
I am stumped, I think using the Top values query I should be able to pull a
query that will list a Customer, as well as the Top three Types of Orders (we
call them styles) they have ordered as well as how many times each was
ordered.
I am trying to use the method provided on this KB
http://support.microsoft.com/kb/q153747/ but maybe it won't work in this
situation.
What I have is two queries , that are listed below, can anybody tell me if
this is possbile, I have tried every combination I can think of and the query
only pulls the Top 3 Values, regardless of Customer.
aaaaaqryGetTop3Styles:
SELECT tblOrders.CustomerID, tblOrders.PGStyle, Count(tblOrders.PGStyle) AS
CountOfPGStyle
FROM tblOrders, tblTempFilterQueries
WHERE (((tblOrders.OrderConfirmDate) Between [TempFilterstartdate] And
[TempFilterEndDate]))
GROUP BY tblOrders.CustomerID, tblOrders.PGStyle
ORDER BY Count(tblOrders.PGStyle) DESC;
And then aaaaaqryTop3Dealer to pull the values by each Customer:
SELECT tblCustomers.CustomerID, aaaaaqryGetTop3Styles.CountOfPGStyle,
aaaaaqryGetTop3Styles.PGStyle
FROM tblCustomers INNER JOIN aaaaaqryGetTop3Styles ON
tblCustomers.CustomerID = aaaaaqryGetTop3Styles.CustomerID
WHERE (((aaaaaqryGetTop3Styles.CountOfPGStyle) In (Select Top 3
[CountOfPGStyle] From aaaaaqryGetTop3Styles Where
[aaaaaqryGetTop3Styles].[CustomerID]=[CustomerID] Order By [CountOfPGStyle]
DESC)))
ORDER BY tblCustomers.CustomerID, aaaaaqryGetTop3Styles.CountOfPGStyle;
Thanks for any assitance, Rick.