查询的复杂性问题
二张表,StockCard为销售日明细表,StoreMonth为销售月汇总表,
由于StockCard很大,想在查询时整月的数据从StoreMonth表查询,
非整月的从StockCard表查询。如:
select * from StockCard
where SaleDay> = '2007-04-1 ' and SaleDay <= '2007-04-7 '
UNION
select * from StoreMonth
where SaleDay> = '2007-05-1 ' and SaleDay <= '2007-05-31 '
UNION
select * from StockCard
where SaleDay> = '2007-06-1 ' and SaleDay <= '2007-06-11 '
能写成视图或者存储过程吗?以减少查询的复杂性
------解决方案--------------------视图和存储过程都有行
------解决方案--------------------2007-04-01至2007-07-07,又如何查?