Home » Listing Details
Top Websites
  1. Dynamics GP Help
    Over 6300 resources listed.
  2. Mark Polino's DynamicAccounting.net
    Over 5100 resources listed.
  3. Rose Business Solutions Blog New
    Over 2200 resources listed.
  4. Developing for Dynamics GP - By David Musgrave and the MS GP Dev Support Team
    Over 1100 resources listed.
  5. Mariano Gomez at The Dynamics GP Blogster
    Over 1000 resources listed.
  6. Microsoft Dynamics Partner Community Blog
    Over 900 resources listed.
  7. Christina Phillips, Steve Endow & Lorren Zemke at Dynamics GP Land
    Over 700 resources listed.
  8. Mohammad Daoud's Dynamics GP Blog
    Over 600 resources listed.
  9. Vaidy Mohan at Dynamics GP - Learn & Discuss
    Over 500 resources listed.
  10. Inside Microsoft Dynamics GP Official Blog
    Over 500 resources listed.
  11. eOne Business Solutions Blog
    Over 400 resources listed.
  12. About Dynamics, Development and Life
    Over 300 resources listed.
  13. Frank Hamelly at GP2theMax
    Over 300 resources listed.
  14. Dynamics CPM
    Over 300 resources listed.
  15. BKD Dynamics GP Insights Blog
    Over 200 resources listed.
  16. Leslie Vail at Dynamics Confessor Blogspot
    Over 200 resources listed.
  17. Victoria Yudin's Dynamics GP Website
    Over 200 resources listed.
    Victoria Yudin
  18. Janakiram M.P. at DynamicsBlogger
    Over 100 resources listed.
  19. VS Tools Forum
    Over 100 resources listed.
    Your Resource for Visual Studio Tools for Dynamics GP
  20. Inside Microsoft Dynamics GP Official Blog
    Over 100 resources listed.
  21. US Dynamics GP Field Team Blog
    Over 100 resources listed.
  22. Catherine Eibner MBS Developer Evangelist
    Over 100 resources listed.
  23. Sivakumar Venkataraman at Interesting Findings & Knowledge Sharing
    Over 100 resources listed.
  24. Dynamics Small Business
    Over 100 resources listed.
  25. Belinda, The GP CSI
    Over 100 resources listed.

Title:Weekly Dynamic: Customers Who Bought “X” Also Bought…
Description:I was reworking the list of SQL Scripts for DynamicAccounting.net and I realized that it would be nice to have some SQL code that showed related items. In other word, something similar to Amazon.com’s “Customers who bought “X” also bought “A”, “M” and “Y”.

I wanted to add a frequency to make it more relevant. What I was looking for was “Customers who bought “X” also bought “A” 56% of the time, “M” 42% of the time and “Y” 38% of the time. I could swear I’ve seen code like this but I couldn’t find it, so…I created it.

I built a SQL Stored Procedure that accepts an inventory item as it’s only parameter and returns other items that were sold on the same invoices along with the percentage of how often they appeared together.
For example, executing the procedure with the item “5-Fee” looks like this: exec BoughtRelated '5-Fee'  and returns this:


This won’t work in SmartList Builder since SLB won’t use a Stored Procedure. To work around that I’ve included a download that does the same thing with Views instead of a stored proc. It’s not as efficient and it takes 3 views to make it happen though I suspect someone smarter than me can make it cleaner. The only other advantages (maybe) to the views is that you could return results for all items, not just one. This could be a plus or it could severely bog down your system if you have enough items and invoices. I told you it was inefficient.

Finally this works off of SOP invoices under the theory that it’s not really bought until it’s invoiced. Also, I didn’t bother including returns because it’s not really relevant from a sales/pairing standpoint. The returns piece is really a different question.

I’ll add these to the permanent SQL Scripts as well.

The files are here:

Related Items Procedure
Related Items Views
Link Owner:
Date Added:June 21, 2010 02:07:09 PM
Number Hits:40
RatingsAverage rating: (0 votes)

No Reviews Yet.


Thank you for your support for GPWindow. It helps us cover part of the hosting costs for GPWindow.