union instances query working