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

Multiple records based on FIFO

$
0
0

hi,

  I need to write sp for selecting some places based on fifo order. My input is quantity so that SP return based on this quantity also. I mean if i give 100 and the first record is 70 only i need to return first and second record based on FIFO

Table1

ID    Place  Quantity  CreatedDate

1       p1        100          2012-04-25

2      p2           50          2013-04-26

3      P3           25          2013-04-27

4      P4         100           2013-04-28

5     P5          75             2013-04-28

--If i give input quantity as 70 i only got P1

--if i give input quantity as 110 i got P1 and p2

Likewise based on the wuantity i need to get FIFO based places. FIFO is from CreatedDate.

Can anyone help to write SP for this? 


Viewing all articles
Browse latest Browse all 23857

Trending Articles



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