Have a score of the string as follows: 1265535165656312653126312312 How can use SQL pleasure find predefined n strings, the emergence of the most times such as n=3, The results of 312, Because the actual amount of data is very big to consider efficiency, use brute force is not workable, consult!
CodePudding user response:
Trouble ah, don't use SQL, take out to use python, Java, feeling the feasibility, Such as the great god
CodePudding user response:
This should also be exhaustive method, other don't arrived,
with t1 as (select '1265535165656312653126312312' c1 from dual) , t2 as (select rownum rn from dual connect by rownum<=(select length (c1) - 2 from t1)) Select * from ( Select substr (c1, rn, and 3) s, the count (*) cThe from t1, t2 Group by substr (c1, rn, 3) The order by the count (*) desc Aa) Where rownum=1
CodePudding user response:
Yes, exhaustive efficiency has some problems, not get, With other process and efficiency problems, did not think of a good algorithm
CodePudding user response:
Still thanks a lot, but efficiency may have a problem,