i have a table in which a row contains following data. So i need to compare data among themselves and show which data has maximum count.for ex. my table has following fruits name. So i need to compare these fruits among themselves and show max fruit count first.
s.no | field1 |
1 |apple,orange,pineapple |
2 |apple,pineapple,strawberry,grapes|
3 |apple,grapes, |
4 |orange,mango |
i.e apple comes first,grapes second,pineapple third and so on. and these datas are entered dynamically, so whatever the values is entered dynamically it needs to compare among themselves and get max count
If you need to run queries on column field 1, then why not consider
normalization? Otherwise it might keep on getting complex and dirty in future.Your current table will look like this (for serianl number 1 only), Pk can be an autoincrement primary key.
Your New Table of Fruits
This also helps you to avoid redundancy.