Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to realize UCF quickly by SQL

2025-01-17 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/03 Report--

This article mainly introduces SQL how to quickly achieve UCF, has a certain reference value, interested friends can refer to, I hope you can learn a lot after reading this article, the following let the editor take you to understand it.

SQLselect uid1,uid2,sim from (select uid1,uid2, cnt12 / sqrt (cnt1*cnt2) sim, row_number () over (partition by uid1 order by cnt12 / sqrt (cnt1*cnt2) desc) sim_rn from (select a.uid uid1, b.uid uid2 Count (a.iid) cnt12 from tb_behavior a join tb_behavior b on a.iid = b.iid where a.uid b.uid group by a.uid B.uid) a12 join (select uid,count (iid) cnt1 from tb_behavior group by uid) A1 on a12.uid1 = a1.uid join (select uid) Count (iid) cnt2 from tb_behavior group by uid) a2 on a12.uid1 = a2.uid) tb_neighbour where sim > 0.1 and sim_rn

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report