A way to make beans less gassy is to soak them in water overnight and then boil the beans for a few minutes and then drain the water from the pot.
Then add fresh water and then cook the beans like normal.
Soaking the beans in water overnight and adding fresh water to the beans can degas the beans.
You can also take an over the counter supplement for reducing gas such as Beano before eating the beans which will reduce the gas buildup in your stomach.