select the most used registrations in mysql

Questions about the MySQL, PostgreSQL, and most other databases, as well as using it with PHP can be asked here.

Moderator: General Moderators

Post Reply
fabby
Forum Commoner
Posts: 62
Joined: Tue Feb 15, 2005 1:06 am
Location: Romania
Contact:

select the most used registrations in mysql

Post 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.
User avatar
jayshields
DevNet Resident
Posts: 1912
Joined: Mon Aug 22, 2005 12:11 pm
Location: Leeds/Manchester, England

Re: select the most used registrations in mysql

Post by jayshields »

What have you tried? You should probably be using a SELECT query with an ORDER BY clause and a LIMIT clause.
fabby
Forum Commoner
Posts: 62
Joined: Tue Feb 15, 2005 1:06 am
Location: Romania
Contact:

Re: select the most used registrations in mysql

Post 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.
User avatar
VladSun
DevNet Master
Posts: 4313
Joined: Wed Jun 27, 2007 9:44 am
Location: Sofia, Bulgaria

Re: select the most used registrations in mysql

Post 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.
There are 10 types of people in this world, those who understand binary and those who don't
fabby
Forum Commoner
Posts: 62
Joined: Tue Feb 15, 2005 1:06 am
Location: Romania
Contact:

Re: select the most used registrations in mysql

Post by fabby »

but with scripting, an easy way, there is?
Post Reply