一个多表联合查询效率问题,该怎么解决?
查询语句:
select * from stroed110101 where id='98760987234' union all
select * from stroed110102 where id='98760987234' union all
select * from stroed110103 where id='98760987234' union all
select * from stroed110104 where id='98760987234' union all
select * from stroed110105 where id='98760987234' union all
select * from stroed110106 where id='98760987234' union all
select * from stroed110107 where id='98760987234' union all
.
.
.
select * from stroed110131 where id='98760987234'
因为各地库存表中记录很多,无法全部保存在在SQL SERVER中的一个表中(总记录数有2000万左右)
因此需要对一种产品进行多表查找,但效率很低,该怎么写这样的SQL来解决实际问题?