日期:2014-05-19  浏览次数:20392 次

再问交叉查询
是不是交叉查询只能用于对表的查询,不能用于对视图进行查询?
或者说交叉查询我想加入
where   datex> =2007-05-01   and   datex <=2007-07-17
能实现吗?不能实现是不是得要先建立个临时表才能达到我所要的效果啊!
谢谢
请教!

------解决方案--------------------
視圖也可以用

where datex> = '2007-05-01 ' and datex < '2007-07-18 '

------解决方案--------------------
.....不错才怪,你自己print 看看

要学会用print @sql
你的条件要放在这
select @sql = left(@sql,len(@sql)-1) + ' from '放在这!! ' SaleTab group by Commodity
exec(@sql)