大家早上好!来请教了...
set @Sql =' from tab1 TD
left join tab2 LS
on ls.flow_bh = td.flow_bh
where TD.op_date Between ''' + @datetimebegin +''' and '''+@DateTimeEnd +''''
set @sSpec = 'select Spec = sum(LS.tchange)' + @Sql + 'and LS.ttype = '''+ @tType +'''' + '条件A 条件b 条件c ... '
exec(@sSpec)
对存储过程不是很熟,向大家请教!