select * from table where company=A order by rand() limit 2 
union
select * from table where company=B order by rand() limit 2 

该语句可以实现 随机取出 AB公司各2条相关数据。