round(((cast(a.xClose as float) - cast(b.xClose as float))/ cast(a.xClose as float)) * 100,2) '漲跌幅'
from
(select *,id0=row_number()over(order by StockNo , Date) from StockDailyHis )a, --今天
(select *,id0=row_number()over(order by StockNo , Date) from StockDailyHis )b --昨天
where 1=1
and a.id0=b.id0+1
and a.StockNo = b.StockNo
and a.Date >= '20140101'
沒有留言:
張貼留言