Quantcast
Channel: Transact-SQL forum
Viewing all articles
Browse latest Browse all 23857

T sql query help to calculate trend.

$
0
0

Hello Forum Members,

I need to calculate the trend.

Trend=Supply +Next Supply-Next Demand.

CREATE

TABLE[dbo].[#Test_Trend](


[RecordNUmber][int]IDENTITY(1,1)NOTNULL,


[City][nvarchar](255)NULL,


[Date][datetime]NULL,


[Supply][float]NULL,


[Demand][float]NULL,


[Trend][float]NULL,

)

ON[PRIMARY]



GO


 

insertinto#test_trendvalues('Seattle','05-01-2014',149,0,'')


 

insertinto#test_trendvalues('Seattle','06-01-2014',0,79,'')


 

insertinto#test_trendvalues('Seattle','07-01-2014',0,402,'')


 

insertinto#test_trendvalues('Seattle','08-01-2014',0,668,'')


 

insertinto#test_trendvalues('Austin','05-01-2014',427,0,'')


 

insertinto#test_trendvalues('Austin','06-01-2014',0,81,'')


 

insertinto#test_trendvalues('Austin','07-01-2014',0,56,'')


 

insertinto#test_trendvalues('Austin','08-01-2014',0,67,'')


Viewing all articles
Browse latest Browse all 23857

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>