都在一个数据库里,用什么存储过程,用union all就可以了select * from rebounddata_all where date = @CurrentDate
union all
select * from rebounddata_all where date = dateadd(year, -1, @CurrentDate)
union all
select * from rebounddata_all where date = dateadd(month, -3, @CurrentDate)
union all
select * from rebounddata_all where date = dateadd(year, -1, @CurrentDate)
union all
select * from rebounddata_all where date = dateadd(month, -3, @CurrentDate)
MIN(a1.[date]) AS [date(1y)],
MIN(a1.[close]) AS [close(1y)],
MIN(a2.[date]) AS [date(3m)],
MIN(a2.[close]) AS [close(3m)]
FROM rebounddata_all a
INNER JOIN briefingplatinum b
ON a.ticker=b.ticker
AND a.[date]=b.[date]
INNER JOIN rebounddata_all a1
ON a.ticker=a1.ticker
AND Year(a.[date])-Year(a1.[date])=1
AND Month(a.[date])=Month(a1.[date])
AND Day(a.[date])=Day(a1.[date])
INNER JOIN rebounddata_all a2
ON a.ticker=a2.ticker
AND Year(a.[date])=Year(a2.[date])
AND Month(a.[date])-Month(a2.[date])=3
AND Day(a.[date])=Day(a2.[date])
GROUP BY b.ticker,b.[date],a.[close]