Question: How to set up a variable on the root directory for the url link in ColdFusion?

I set up the variable on the root directory for the url link, appweb\instance.cfm:

```
<CFSCRIPT>
 ...
 ...     
  Application.MainLink = "http://www.ucdavis.edu/index.html";

</CFSCRIPT>

```

I have a file under appweb/costsharing/footer.cfm to use the variable for url link, but it doesn't work. 

```
<br />
<br />
<div align="center">
<b>Need Help?  Visit the <a href="#Application.MainLink#" target=_blank>Cost    Sharing Help</a></b>
</div>
<br />
<br />
<CFInclude Template="../OnRequestEnd.cfm">

</body>
</html>

```

Any suggestion?

Answer: 
The following query is based on MySQL, but you can tweak it to make it work for SQL server. I hope SQL Server will also support the same

```
select o.date, t.tsales - sum(sales) delta  from test o, (select date, sum(sales) tsales from test group by date) t
where o.date = t.date -1 group by o.date

```

For the above query I got the following result

"date" "delta"
"2015-01-01" "90"
"2015-01-02" "150"
"2015-01-03" "80"
Try this..

SELECT date, 

```
  ( sum(sales) - LAG(sum(sales),1,0) over (order by sales) ) as dailyDelta

```

FROM Table

group by date

order by date;