Quantcast
Channel: SQL Server Reporting Services, Power View forum
Viewing all articles
Browse latest Browse all 28687

Populating previous value

$
0
0

Hi I have a SQL QUERY

SELECT ID,ApptDate,OpDate,SacSize,
    ( SELECT TOP 1 b.SacSize
      FROM Table.vAllData as b
      WHERE b.ApptDate< a.ApptDate
      ORDER BY to_number(b.ID) Desc
    ) AS Prev_Value
FROM Table.vAllData a where HospNumber='N900001'

the above query Outputs the below, but unfortunatuly i cant get the 'previous_value' column working to populate from the second row, am i missing some thing?

IDApptDateOpDateSacSizePrev_Value
<empty>01/01/201301/01/20135 
125108/01/201304/01/20136 
125210/01/201310/01/201336
125314/01/201314/01/201323
125416/01/201316/01/201362

many thanks


Viewing all articles
Browse latest Browse all 28687

Trending Articles



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