查找相关购买的产品(SQL server database) [英] Find related bought products (SQL server database)

查看:66
本文介绍了查找相关购买的产品(SQL server database)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要账单和BillDetails



i have to tables bills and BillDetails

bill table contain the following fields 

billId, salesManId, purchaseBranch

billDetails table contain the following fields

billDetailId , billId, productId,  purchaseBranch, Quantity



what我想报告找到前2个相关产品





例如



1-人购买iphoneX已购买

Nomad Rugged Cable

Kenu Stance Tripod





2-人购买了三星s5282已购买

蓝牙键盘

MP3播放器



i知道它是有点叫推荐系统,但我不知道如何实现它



我尝试过:

< br $>
i搜索


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

但不知道如何实现它

推荐答案

1 ) C按产品ID列出的帐单明细;取两个顶部。



2)对于每个顶级产品,从Bill详细信息中获取相关的Bill Id's



3)对于每个顶级产品和账单ID,获得该账单上的其他产品,不包括顶级产品



4)按顶部计算所选产品,账单ID,其他产品记录;获得2个顶级产品中的每一个的前2名
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


这篇关于查找相关购买的产品(SQL server database)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆