日期:2014-05-17 浏览次数:20669 次
select GoodsSale201310.PluCode,goods.pluname,goods.barcode,vendor.vendorcode,vendor.vendorname,
subshop.orgcode,subshop.orgname,GoodsSale201310.Counts,cast(GoodsSale201310.AccDate as datetime) as AccDate,GoodsSale201310.Amount,
GoodsSale201310.PriceDsc,GoodsSale201310.Cost from GoodsSale201310
inner join goods on GoodsSale201310.plucode = goods.plucode left outer join subshop on GoodsSale201310.orgcode = subshop.orgcode
left outer join vendor on vendor.vendorcode = GoodsSale201310.vendorcode
declare @sql nvarchar(4000)
declare @str nvarchar(6)
set @str = convert(nvarchar(6),getdate(),112)
set @sql = '
select GoodsSale201310.PluCode,goods.pluname,goods.barcode,
vendor.vendorcode,vendor.vendorname,
subshop.orgcode,subshop.orgname,
GoodsSale201310.Counts,
cast(GoodsSale201310.AccDate as datetime) as AccDate,
GoodsSale201310.Amount,
GoodsSale201310.PriceDsc,GoodsSale201310.Cost
from GoodsSale201310
inner join goods
on GoodsSale201310.plucode = goods.plucode
left outer join subshop
on GoodsSale201310.orgcode = subshop.orgcode
left outer join vendor
on vendor.vendorcode = GoodsSale201310.vendorcode'
set @sql = replace(@sql,'201310',@str)
--select @sql
exec(@sql)