Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
Author |
Topic |
jcarrallo
Starting Member
35 Posts |
Posted - 2014-05-19 : 05:53:21
|
Hello Team, Please help me with this query:The table is as follows:PVL_Date | PVL_Symbol | Pvl_Daily_Return01/02/2013 | GOOG| 0,1202/02/2013 | GOOG| -0,0703/02/2013 | GOOG| 0,21201/02/2013 | AAPL| -0,1902/02/2013 | AAPL| 0,3303/02/2013 | AAPL| -0,43And below is a query to get a list of prices for a specific stock by date, and where I accumulate the daily return. Select Pvl_Date, Pvl_Symbol, SUM(Pvl_Daily_Return) OVER (ORDER BY pvl_date) AS 'Accumulated'FROM Stock_Prices WHERE Pvl_Symbol = 'GOOG' and pvl_Date > '31/01/13'Order by Pvl_DateAnd the result of this query is:PVL_Date | PVL_Symbol | Accumulated01/02/2013 | GOOG| 0,1202/02/2013 | GOOG| -0,0503/02/2013 | GOOG| 0,262So this is all fine, except that I would need to include a '0' right at the begining of the list. So in other words, I would need the query result to be: PVL_Date | PVL_Symbol | Accumulated31/01/2013 | GOOG| 001/02/2013 | GOOG| 0,1202/02/2013 | GOOG| -0,0503/02/2013 | GOOG| 0,262Can anyone help with this?Many thanks in advancedJay |
|
kostya1122
Starting Member
15 Posts |
Posted - 2014-05-19 : 14:05:54
|
pvl_Date >= '31/01/13' |
 |
|
jcarrallo
Starting Member
35 Posts |
Posted - 2014-05-20 : 14:53:03
|
Thanks. This will do.Best,Jay |
 |
|
|
|
|
|
|