Help to build mysql query

0

I have the following table in MySQL: cod, d1, d2, d3, d4, d5, d6, d7, d8, d9, d10, d11, d12, d13, d14, d15 the fields d1 ... d15 are filled with values between 1 and 25 in each record. There is no repetition of values within a record. How can I make queries to find more frequent groups that are repeated in the records? Example: identify how many times the group of values 1,5,10,15,20,25 appeared in the records. Would it be possible to create a generic query to identify which groups were most frequent?

    
asked by anonymous 12.02.2018 / 02:33

1 answer

0

I would say that this search summarizes the information in the table in order to get the desired one.

SELECT
    case when d1=1 or 
                        d2=1 or 
    (...) 
                        d15=1
    then 1
    else 0 as dx1 count,
    case when d1=2 or
                         d2=2 or
     (...)
      then 1
      else 0 as dx2 count
(.....) 
from {table} ;
    
20.03.2018 / 00:58