Page 1 of 1

select the most used registrations in mysql

Posted: Fri Mar 20, 2009 6:57 am
by fabby
Hi.
I don't know how to solve a problem in mysql.
I have this structure
Game_cod
------------
ID _ _ COD _ _ _ _ _ _ _ _ _ COD_AFERENT
1 _ _ 23,54,23,57,12,545 _ _ 1;1;10;2;1;12
2. _ _23,44,69,12,33,844 _ _0;1;02;0;3;3

etc

and i have to select the most used "cod" and then to find out the most used "cod_aferent".
Thanks.

Re: select the most used registrations in mysql

Posted: Fri Mar 20, 2009 8:22 am
by jayshields
What have you tried? You should probably be using a SELECT query with an ORDER BY clause and a LIMIT clause.

Re: select the most used registrations in mysql

Posted: Fri Mar 20, 2009 9:40 am
by fabby
how to make in mysql??

a solution is to explode fields (in php) and find what is most used, and etc..buy is not so good. i want to know if do you know a solution in mysql.

Re: select the most used registrations in mysql

Posted: Fri Mar 20, 2009 1:04 pm
by VladSun
fabby wrote:a solution is to explode fields (in php) and find what is most used, and etc..buy is not so good. i want to know if do you know a solution in mysql.
Well, that means your DB design is wrong. You should normalize your DB - i.e. to have only atomic fileds.

Re: select the most used registrations in mysql

Posted: Fri Mar 20, 2009 3:35 pm
by fabby
but with scripting, an easy way, there is?