Good info in this thread, I just want to expand on what "community" means to provide some insight.
To be a successful "community" aquarium, the fish selected must be compatible in more ways than just behaviour, which is the aspect most aquarists usually consider. But there is much more. Compatible means the fish all share the same or very nearly the same preferences for water parameters (pH, hardness, temperature) and environment (plants, rocks, wood, caves, sand/gravel, water movement, lighting). Some fish have very specific needs in one or more of these areas, and combining two species with differing needs will guarantee that one or both species will not be at its best due to stress from the environment or water conditions. And stress affects the fish's immune system, which means the likelihood of disease is increased, and frequently internal damage occurs that we cannot detect visually but results in shorter-than-normal lifespans even if the fish is able to still fight off other issues.
How a fish copes with its environment has a tremendous impact on its health. The fish's physiology requires that it regulates the pH of its blood to match the environment; soft water fish in hard water develop calcium deposits internally; a fish programmed by evolution to live in dark waters among plants will, if put in a brightly-lit aquarium with no plants, constantly feel vulnerable and under attack. All of these things cause stress, and in fish just as in humans, stress is a major factor in disease and longevity.