Click here to Skip to main content
15,896,557 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
See more:
i have to tables bills and BillDetails

C#
bill table contain the following fields 

billId, salesManId, purchaseBranch

billDetails table contain the following fields

billDetailId , billId, productId,  purchaseBranch, Quantity

what i want is report to find top 2 related products


for example

1- people bought iphoneX bought
Nomad Rugged Cable
Kenu Stance Tripod


2- people bought Samsung s5282 bought
Bluetooth Keyboards
MP3 Player

i know it is somewhat called recommendation system but i can not know how to implement it

What I have tried:

i searched for
recommendation system
but can not know how to implement it
Posted
Updated 29-Jul-18 7:32am

1 solution

1) Count Bill Details by Product Id; take the top 2.

2) For each "top" product, get the related Bill Id's from Bill Details

3) For each top product and Bill Id, get the "other" product's on that bill, excluding top product

4) Count the selected by top product, bill id, other product records; take the top 2 for each of the 2 "top" products
 
Share this answer
 
v2
Comments
TheSniper105 30-Jul-18 1:15am    
1) Count Bill Details by Product Id; take the top 2.
how ?

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900