Group by 'other', where groups with small contribution are included in 'other' field - MySQL -


I would like to group through an item in my table, which has an affiliate monetary value. I can work as a percentage of this, although there are a lot of things in the list (many are useful, for example in a graph) As a result, I would like to keep those items which are 5% in an 'other' group Have less ideas in lesser stories, any ideas?

It seems as if a union can help, like (dependent) How to organize your table, definitely):

  item item is itemized as item number, SUM (percentage), item by item item type (percent) > = 0.05 Select the union from the 'Other' items in the item group (*) (*) (*) from SAM (*) SIM (percent) HIPIT item typing Sam (percent) <0.045)  < / Pre> 

if you There is no percentage area but only (say to say) a value field (so% is dynamically calculated as equivalent to 100 times the value of an item) You can get a grand total from another nested SELECT But, at some point it may be worth the change in procedural approaches, as the other responder signs.


Comments

Popular posts from this blog

python - Overriding the save method in Django ModelForm -

html - CSS autoheight, but fit content to height of div -

qt - How to prevent QAudioInput from automatically boosting the master volume to 100%? -