SQL Basics

 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me



Go Back   Tutorialized ForumsDatabasesSQL Basics

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Tutorialized Forums Sponsor:
  #1  
Old November 20th, 2015, 07:07 AM
ggulumar ggulumar is offline
Registered User
Tutorialized Newbie (0 - 499 posts)
 
Join Date: Nov 2015
Posts: 1 ggulumar User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 h 41 m 55 sec
Reputation Power: 0
Get 20 most frequent pairs(2/2) and triplets(3/3) of numbers mysql

I'm trying to get the 20 most frequent pairs(2/2) and triplets(3/3) of numbers, my table looks like this:
Code:
+----+------+------+------+------+------+------+------+------+------+------+
| id | nr_1 | nr_2 | nr_3 | nr_4 | nr_5 | nr_6 | nr_7 | nr_8 | nr_9 | nr_10|
+----+------+------+------+------+------+------+------+------+------+------+
| 1  | 1    | 3    | 19   | 23   | 28   | 32   | 39   | 42   | 60   | 80   |
+----+------+------+------+------+------+------+------+------+------+------+
| 2  | 1    | 3    | 18   | 24   | 29   | 33   | 40   | 43   | 61   | 80   |
+----+------+------+------+------+------+------+------+------+------+------+
| 3  | 1    | 2    | 3    | 25   | 30   | 34   | 41   | 44   | 62   | 78   |
+----+------+------+------+------+------+------+------+------+------+------+


Imagine that there is a lottery with 10 drawn numbers out of 80 and in the table are the results.

I want a way to find the most drawn pairs and triplets from any numbers of draws.

Per example:

Pairs of numbers(two numbers that have been drawn toghether):

-the numbers 1 and 3 have been drawn together 3 times, which makes it the most drawn pair of numbers out of the 3 draws.

-the numbers 1 and 80 have been drawn together 2 times along with 3,80 which also has been drawn 2 times out of 3 draws.

As for most drawn triplets( any combination of 3 numbers):

-1,3,80 is the most common triplet, being drawn together 2 times out of the 3 draws.

Last edited by ggulumar : November 20th, 2015 at 10:15 AM.

Reply With Quote
Reply

Viewing: Tutorialized ForumsDatabasesSQL Basics > Get 20 most frequent pairs(2/2) and triplets(3/3) of numbers mysql


Developer Shed Advertisers and Affiliates


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 

Powered by: vBulletin Version 3.0.5
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.

© 2003-2017 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap