SQLite - performing calculation on preceding rows










0















The problem is this. If I have a quantity in any location, I want to perform the calculation below to each member of that job_no.



The idea is that if there's a quantity in loc3, the same quantity was previously in loc1 and loc2.



So, how do I get 10 in loc1 and loc2 may be another way to put it..?



select s.job_no, s.part, s.location, s.qty, 
coalesce(ptime.setup_time, '-') as setup_time,
coalesce(ptime.cycle_time, '-') as cycle_time,
ci.rate
from stock as s join part_timings as pt
on pt.part = s.part
join locations as l on s.location = l.location
left join part_timings as ptime on s.part = ptime.part
and ptime.location = s.location
join costs_internal as ci
group by s.part, s.location
order by s.part, l.stage



job_no | part | location | qty | setup_time | cycle_time | rate | total
123 p1 loc1 0 60 30 0.5 ?
123 p1 loc2 0 30 15 0.5 ?
123 p1 loc3 10 60 15 0.5 ?
123 p1 loc4 0 60 15 0.5 ?
123 p1 loc5 0 60 15 0.5 ?
123 p1 loc6 0 60 15 0.5 ?
123 p1 loc7 20 60 15 0.5 ?


calculation to get total:



coalesce(round((pt.cycle_time * s.qty * ci.rate) + 
(pt.setup_time * ci.rate), 2), '-')


EDIT:



I've added loc4 to loc7.



loc3 would need to have the calculation applied to loc1 and loc2 (qty 10).



loc7 would need to have the calculation applied to all locations that are before it (qty 20).



Maybe I'm not explaining it perfectly, struggle to get my intentions across sometimes with SQL!










share|improve this question
























  • Do you want qty to be updated in the table? Or leave them at 0 and just have 10 in the query? And is that for all locations or just ones that are "less than" loc3? Would it also go for loc4?

    – Schwern
    Nov 12 '18 at 18:53












  • I just need qty for the query, Schwern.

    – S1M0N_H
    Nov 12 '18 at 18:54











  • Sorry, there may be upto loc7. Whichever one has a qty should have the same qty applied to all preceeding locations. Hope that makes sense.

    – S1M0N_H
    Nov 12 '18 at 19:01











  • Thanks. If you edit your question to show the output you want, as well as the output you have, that would help others to answer. Be sure to include a loc4 in the sample.

    – Schwern
    Nov 12 '18 at 19:17











  • Will you ever have two locations with a non-zero qty? If so, which one gets chosen?

    – Schwern
    Nov 12 '18 at 19:19















0















The problem is this. If I have a quantity in any location, I want to perform the calculation below to each member of that job_no.



The idea is that if there's a quantity in loc3, the same quantity was previously in loc1 and loc2.



So, how do I get 10 in loc1 and loc2 may be another way to put it..?



select s.job_no, s.part, s.location, s.qty, 
coalesce(ptime.setup_time, '-') as setup_time,
coalesce(ptime.cycle_time, '-') as cycle_time,
ci.rate
from stock as s join part_timings as pt
on pt.part = s.part
join locations as l on s.location = l.location
left join part_timings as ptime on s.part = ptime.part
and ptime.location = s.location
join costs_internal as ci
group by s.part, s.location
order by s.part, l.stage



job_no | part | location | qty | setup_time | cycle_time | rate | total
123 p1 loc1 0 60 30 0.5 ?
123 p1 loc2 0 30 15 0.5 ?
123 p1 loc3 10 60 15 0.5 ?
123 p1 loc4 0 60 15 0.5 ?
123 p1 loc5 0 60 15 0.5 ?
123 p1 loc6 0 60 15 0.5 ?
123 p1 loc7 20 60 15 0.5 ?


calculation to get total:



coalesce(round((pt.cycle_time * s.qty * ci.rate) + 
(pt.setup_time * ci.rate), 2), '-')


EDIT:



I've added loc4 to loc7.



loc3 would need to have the calculation applied to loc1 and loc2 (qty 10).



loc7 would need to have the calculation applied to all locations that are before it (qty 20).



Maybe I'm not explaining it perfectly, struggle to get my intentions across sometimes with SQL!










share|improve this question
























  • Do you want qty to be updated in the table? Or leave them at 0 and just have 10 in the query? And is that for all locations or just ones that are "less than" loc3? Would it also go for loc4?

    – Schwern
    Nov 12 '18 at 18:53












  • I just need qty for the query, Schwern.

    – S1M0N_H
    Nov 12 '18 at 18:54











  • Sorry, there may be upto loc7. Whichever one has a qty should have the same qty applied to all preceeding locations. Hope that makes sense.

    – S1M0N_H
    Nov 12 '18 at 19:01











  • Thanks. If you edit your question to show the output you want, as well as the output you have, that would help others to answer. Be sure to include a loc4 in the sample.

    – Schwern
    Nov 12 '18 at 19:17











  • Will you ever have two locations with a non-zero qty? If so, which one gets chosen?

    – Schwern
    Nov 12 '18 at 19:19













0












0








0








The problem is this. If I have a quantity in any location, I want to perform the calculation below to each member of that job_no.



The idea is that if there's a quantity in loc3, the same quantity was previously in loc1 and loc2.



So, how do I get 10 in loc1 and loc2 may be another way to put it..?



select s.job_no, s.part, s.location, s.qty, 
coalesce(ptime.setup_time, '-') as setup_time,
coalesce(ptime.cycle_time, '-') as cycle_time,
ci.rate
from stock as s join part_timings as pt
on pt.part = s.part
join locations as l on s.location = l.location
left join part_timings as ptime on s.part = ptime.part
and ptime.location = s.location
join costs_internal as ci
group by s.part, s.location
order by s.part, l.stage



job_no | part | location | qty | setup_time | cycle_time | rate | total
123 p1 loc1 0 60 30 0.5 ?
123 p1 loc2 0 30 15 0.5 ?
123 p1 loc3 10 60 15 0.5 ?
123 p1 loc4 0 60 15 0.5 ?
123 p1 loc5 0 60 15 0.5 ?
123 p1 loc6 0 60 15 0.5 ?
123 p1 loc7 20 60 15 0.5 ?


calculation to get total:



coalesce(round((pt.cycle_time * s.qty * ci.rate) + 
(pt.setup_time * ci.rate), 2), '-')


EDIT:



I've added loc4 to loc7.



loc3 would need to have the calculation applied to loc1 and loc2 (qty 10).



loc7 would need to have the calculation applied to all locations that are before it (qty 20).



Maybe I'm not explaining it perfectly, struggle to get my intentions across sometimes with SQL!










share|improve this question
















The problem is this. If I have a quantity in any location, I want to perform the calculation below to each member of that job_no.



The idea is that if there's a quantity in loc3, the same quantity was previously in loc1 and loc2.



So, how do I get 10 in loc1 and loc2 may be another way to put it..?



select s.job_no, s.part, s.location, s.qty, 
coalesce(ptime.setup_time, '-') as setup_time,
coalesce(ptime.cycle_time, '-') as cycle_time,
ci.rate
from stock as s join part_timings as pt
on pt.part = s.part
join locations as l on s.location = l.location
left join part_timings as ptime on s.part = ptime.part
and ptime.location = s.location
join costs_internal as ci
group by s.part, s.location
order by s.part, l.stage



job_no | part | location | qty | setup_time | cycle_time | rate | total
123 p1 loc1 0 60 30 0.5 ?
123 p1 loc2 0 30 15 0.5 ?
123 p1 loc3 10 60 15 0.5 ?
123 p1 loc4 0 60 15 0.5 ?
123 p1 loc5 0 60 15 0.5 ?
123 p1 loc6 0 60 15 0.5 ?
123 p1 loc7 20 60 15 0.5 ?


calculation to get total:



coalesce(round((pt.cycle_time * s.qty * ci.rate) + 
(pt.setup_time * ci.rate), 2), '-')


EDIT:



I've added loc4 to loc7.



loc3 would need to have the calculation applied to loc1 and loc2 (qty 10).



loc7 would need to have the calculation applied to all locations that are before it (qty 20).



Maybe I'm not explaining it perfectly, struggle to get my intentions across sometimes with SQL!







sqlite






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Nov 12 '18 at 19:30







S1M0N_H

















asked Nov 12 '18 at 18:50









S1M0N_HS1M0N_H

2525




2525












  • Do you want qty to be updated in the table? Or leave them at 0 and just have 10 in the query? And is that for all locations or just ones that are "less than" loc3? Would it also go for loc4?

    – Schwern
    Nov 12 '18 at 18:53












  • I just need qty for the query, Schwern.

    – S1M0N_H
    Nov 12 '18 at 18:54











  • Sorry, there may be upto loc7. Whichever one has a qty should have the same qty applied to all preceeding locations. Hope that makes sense.

    – S1M0N_H
    Nov 12 '18 at 19:01











  • Thanks. If you edit your question to show the output you want, as well as the output you have, that would help others to answer. Be sure to include a loc4 in the sample.

    – Schwern
    Nov 12 '18 at 19:17











  • Will you ever have two locations with a non-zero qty? If so, which one gets chosen?

    – Schwern
    Nov 12 '18 at 19:19

















  • Do you want qty to be updated in the table? Or leave them at 0 and just have 10 in the query? And is that for all locations or just ones that are "less than" loc3? Would it also go for loc4?

    – Schwern
    Nov 12 '18 at 18:53












  • I just need qty for the query, Schwern.

    – S1M0N_H
    Nov 12 '18 at 18:54











  • Sorry, there may be upto loc7. Whichever one has a qty should have the same qty applied to all preceeding locations. Hope that makes sense.

    – S1M0N_H
    Nov 12 '18 at 19:01











  • Thanks. If you edit your question to show the output you want, as well as the output you have, that would help others to answer. Be sure to include a loc4 in the sample.

    – Schwern
    Nov 12 '18 at 19:17











  • Will you ever have two locations with a non-zero qty? If so, which one gets chosen?

    – Schwern
    Nov 12 '18 at 19:19
















Do you want qty to be updated in the table? Or leave them at 0 and just have 10 in the query? And is that for all locations or just ones that are "less than" loc3? Would it also go for loc4?

– Schwern
Nov 12 '18 at 18:53






Do you want qty to be updated in the table? Or leave them at 0 and just have 10 in the query? And is that for all locations or just ones that are "less than" loc3? Would it also go for loc4?

– Schwern
Nov 12 '18 at 18:53














I just need qty for the query, Schwern.

– S1M0N_H
Nov 12 '18 at 18:54





I just need qty for the query, Schwern.

– S1M0N_H
Nov 12 '18 at 18:54













Sorry, there may be upto loc7. Whichever one has a qty should have the same qty applied to all preceeding locations. Hope that makes sense.

– S1M0N_H
Nov 12 '18 at 19:01





Sorry, there may be upto loc7. Whichever one has a qty should have the same qty applied to all preceeding locations. Hope that makes sense.

– S1M0N_H
Nov 12 '18 at 19:01













Thanks. If you edit your question to show the output you want, as well as the output you have, that would help others to answer. Be sure to include a loc4 in the sample.

– Schwern
Nov 12 '18 at 19:17





Thanks. If you edit your question to show the output you want, as well as the output you have, that would help others to answer. Be sure to include a loc4 in the sample.

– Schwern
Nov 12 '18 at 19:17













Will you ever have two locations with a non-zero qty? If so, which one gets chosen?

– Schwern
Nov 12 '18 at 19:19





Will you ever have two locations with a non-zero qty? If so, which one gets chosen?

– Schwern
Nov 12 '18 at 19:19












1 Answer
1






active

oldest

votes


















0














Using a simplified version of your data...



select * from stock;

job_no qty location
---------- ---------- ----------
123 0 loc1
123 0 loc2
123 10 loc3
123 0 loc4
456 0 loc1
456 20 loc2


You can use a sub-select to get the quantity for each job and join with it to get the stock for each job.



select stock.*, stocked.qty
from stock
join (select * from stock s where s.qty != 0) as stocked
on stock.job_no = stocked.job_no;

job_no qty location qty
---------- ---------- ---------- ----------
123 0 loc1 10
123 0 loc2 10
123 0 loc4 10
123 10 loc3 10
456 0 loc1 20
456 20 loc2 20


stocked has the row for each job which is currently stocked.



Note that unless you've made a restriction, there may be more than one stocked row for a job.





loc7 would need to have the calculation applied to all locations that are before it (qty 20).




With this data...



sqlite> select * from stock order by job_no, location;
job_no qty location
---------- ---------- ----------
123 0 loc1
123 0 loc2
123 10 loc3
123 0 loc4
123 0 loc5
123 0 loc6
123 20 loc7
456 0 loc1
456 20 loc2


To accomplish this, instead of joining on the subselect do it on a per column basis else we'll get multiple values stocked locations. (There's probably also a way to do it with a join)



In order to make sure we select only previous locations (or our own) it's necessary to check that stock.location <= stocked.location. In order to ensure we get the closest one, order them by location and select only the first one.



select stock.*, (
select stocked.qty
from stock stocked
where stock.job_no = stocked.job_no
and qty != 0
and stock.location <= stocked.location
order by stocked.location asc
limit 1
) as stocked_qty
from stock
order by job_no, location;

job_no qty location stocked_qty
---------- ---------- ---------- -----------
123 0 loc1 10
123 0 loc2 10
123 10 loc3 10
123 0 loc4 20
123 0 loc5 20
123 0 loc6 20
123 20 loc7 20
456 0 loc1 20
456 20 loc2 20


This may be inefficient as a column subselect. It's important that job_no, qty, and location are all indexed.






share|improve this answer
























    Your Answer






    StackExchange.ifUsing("editor", function ()
    StackExchange.using("externalEditor", function ()
    StackExchange.using("snippets", function ()
    StackExchange.snippets.init();
    );
    );
    , "code-snippets");

    StackExchange.ready(function()
    var channelOptions =
    tags: "".split(" "),
    id: "1"
    ;
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function()
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled)
    StackExchange.using("snippets", function()
    createEditor();
    );

    else
    createEditor();

    );

    function createEditor()
    StackExchange.prepareEditor(
    heartbeatType: 'answer',
    autoActivateHeartbeat: false,
    convertImagesToLinks: true,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: 10,
    bindNavPrevention: true,
    postfix: "",
    imageUploader:
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    ,
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    );



    );













    draft saved

    draft discarded


















    StackExchange.ready(
    function ()
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53268346%2fsqlite-performing-calculation-on-preceding-rows%23new-answer', 'question_page');

    );

    Post as a guest















    Required, but never shown

























    1 Answer
    1






    active

    oldest

    votes








    1 Answer
    1






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    0














    Using a simplified version of your data...



    select * from stock;

    job_no qty location
    ---------- ---------- ----------
    123 0 loc1
    123 0 loc2
    123 10 loc3
    123 0 loc4
    456 0 loc1
    456 20 loc2


    You can use a sub-select to get the quantity for each job and join with it to get the stock for each job.



    select stock.*, stocked.qty
    from stock
    join (select * from stock s where s.qty != 0) as stocked
    on stock.job_no = stocked.job_no;

    job_no qty location qty
    ---------- ---------- ---------- ----------
    123 0 loc1 10
    123 0 loc2 10
    123 0 loc4 10
    123 10 loc3 10
    456 0 loc1 20
    456 20 loc2 20


    stocked has the row for each job which is currently stocked.



    Note that unless you've made a restriction, there may be more than one stocked row for a job.





    loc7 would need to have the calculation applied to all locations that are before it (qty 20).




    With this data...



    sqlite> select * from stock order by job_no, location;
    job_no qty location
    ---------- ---------- ----------
    123 0 loc1
    123 0 loc2
    123 10 loc3
    123 0 loc4
    123 0 loc5
    123 0 loc6
    123 20 loc7
    456 0 loc1
    456 20 loc2


    To accomplish this, instead of joining on the subselect do it on a per column basis else we'll get multiple values stocked locations. (There's probably also a way to do it with a join)



    In order to make sure we select only previous locations (or our own) it's necessary to check that stock.location <= stocked.location. In order to ensure we get the closest one, order them by location and select only the first one.



    select stock.*, (
    select stocked.qty
    from stock stocked
    where stock.job_no = stocked.job_no
    and qty != 0
    and stock.location <= stocked.location
    order by stocked.location asc
    limit 1
    ) as stocked_qty
    from stock
    order by job_no, location;

    job_no qty location stocked_qty
    ---------- ---------- ---------- -----------
    123 0 loc1 10
    123 0 loc2 10
    123 10 loc3 10
    123 0 loc4 20
    123 0 loc5 20
    123 0 loc6 20
    123 20 loc7 20
    456 0 loc1 20
    456 20 loc2 20


    This may be inefficient as a column subselect. It's important that job_no, qty, and location are all indexed.






    share|improve this answer





























      0














      Using a simplified version of your data...



      select * from stock;

      job_no qty location
      ---------- ---------- ----------
      123 0 loc1
      123 0 loc2
      123 10 loc3
      123 0 loc4
      456 0 loc1
      456 20 loc2


      You can use a sub-select to get the quantity for each job and join with it to get the stock for each job.



      select stock.*, stocked.qty
      from stock
      join (select * from stock s where s.qty != 0) as stocked
      on stock.job_no = stocked.job_no;

      job_no qty location qty
      ---------- ---------- ---------- ----------
      123 0 loc1 10
      123 0 loc2 10
      123 0 loc4 10
      123 10 loc3 10
      456 0 loc1 20
      456 20 loc2 20


      stocked has the row for each job which is currently stocked.



      Note that unless you've made a restriction, there may be more than one stocked row for a job.





      loc7 would need to have the calculation applied to all locations that are before it (qty 20).




      With this data...



      sqlite> select * from stock order by job_no, location;
      job_no qty location
      ---------- ---------- ----------
      123 0 loc1
      123 0 loc2
      123 10 loc3
      123 0 loc4
      123 0 loc5
      123 0 loc6
      123 20 loc7
      456 0 loc1
      456 20 loc2


      To accomplish this, instead of joining on the subselect do it on a per column basis else we'll get multiple values stocked locations. (There's probably also a way to do it with a join)



      In order to make sure we select only previous locations (or our own) it's necessary to check that stock.location <= stocked.location. In order to ensure we get the closest one, order them by location and select only the first one.



      select stock.*, (
      select stocked.qty
      from stock stocked
      where stock.job_no = stocked.job_no
      and qty != 0
      and stock.location <= stocked.location
      order by stocked.location asc
      limit 1
      ) as stocked_qty
      from stock
      order by job_no, location;

      job_no qty location stocked_qty
      ---------- ---------- ---------- -----------
      123 0 loc1 10
      123 0 loc2 10
      123 10 loc3 10
      123 0 loc4 20
      123 0 loc5 20
      123 0 loc6 20
      123 20 loc7 20
      456 0 loc1 20
      456 20 loc2 20


      This may be inefficient as a column subselect. It's important that job_no, qty, and location are all indexed.






      share|improve this answer



























        0












        0








        0







        Using a simplified version of your data...



        select * from stock;

        job_no qty location
        ---------- ---------- ----------
        123 0 loc1
        123 0 loc2
        123 10 loc3
        123 0 loc4
        456 0 loc1
        456 20 loc2


        You can use a sub-select to get the quantity for each job and join with it to get the stock for each job.



        select stock.*, stocked.qty
        from stock
        join (select * from stock s where s.qty != 0) as stocked
        on stock.job_no = stocked.job_no;

        job_no qty location qty
        ---------- ---------- ---------- ----------
        123 0 loc1 10
        123 0 loc2 10
        123 0 loc4 10
        123 10 loc3 10
        456 0 loc1 20
        456 20 loc2 20


        stocked has the row for each job which is currently stocked.



        Note that unless you've made a restriction, there may be more than one stocked row for a job.





        loc7 would need to have the calculation applied to all locations that are before it (qty 20).




        With this data...



        sqlite> select * from stock order by job_no, location;
        job_no qty location
        ---------- ---------- ----------
        123 0 loc1
        123 0 loc2
        123 10 loc3
        123 0 loc4
        123 0 loc5
        123 0 loc6
        123 20 loc7
        456 0 loc1
        456 20 loc2


        To accomplish this, instead of joining on the subselect do it on a per column basis else we'll get multiple values stocked locations. (There's probably also a way to do it with a join)



        In order to make sure we select only previous locations (or our own) it's necessary to check that stock.location <= stocked.location. In order to ensure we get the closest one, order them by location and select only the first one.



        select stock.*, (
        select stocked.qty
        from stock stocked
        where stock.job_no = stocked.job_no
        and qty != 0
        and stock.location <= stocked.location
        order by stocked.location asc
        limit 1
        ) as stocked_qty
        from stock
        order by job_no, location;

        job_no qty location stocked_qty
        ---------- ---------- ---------- -----------
        123 0 loc1 10
        123 0 loc2 10
        123 10 loc3 10
        123 0 loc4 20
        123 0 loc5 20
        123 0 loc6 20
        123 20 loc7 20
        456 0 loc1 20
        456 20 loc2 20


        This may be inefficient as a column subselect. It's important that job_no, qty, and location are all indexed.






        share|improve this answer















        Using a simplified version of your data...



        select * from stock;

        job_no qty location
        ---------- ---------- ----------
        123 0 loc1
        123 0 loc2
        123 10 loc3
        123 0 loc4
        456 0 loc1
        456 20 loc2


        You can use a sub-select to get the quantity for each job and join with it to get the stock for each job.



        select stock.*, stocked.qty
        from stock
        join (select * from stock s where s.qty != 0) as stocked
        on stock.job_no = stocked.job_no;

        job_no qty location qty
        ---------- ---------- ---------- ----------
        123 0 loc1 10
        123 0 loc2 10
        123 0 loc4 10
        123 10 loc3 10
        456 0 loc1 20
        456 20 loc2 20


        stocked has the row for each job which is currently stocked.



        Note that unless you've made a restriction, there may be more than one stocked row for a job.





        loc7 would need to have the calculation applied to all locations that are before it (qty 20).




        With this data...



        sqlite> select * from stock order by job_no, location;
        job_no qty location
        ---------- ---------- ----------
        123 0 loc1
        123 0 loc2
        123 10 loc3
        123 0 loc4
        123 0 loc5
        123 0 loc6
        123 20 loc7
        456 0 loc1
        456 20 loc2


        To accomplish this, instead of joining on the subselect do it on a per column basis else we'll get multiple values stocked locations. (There's probably also a way to do it with a join)



        In order to make sure we select only previous locations (or our own) it's necessary to check that stock.location <= stocked.location. In order to ensure we get the closest one, order them by location and select only the first one.



        select stock.*, (
        select stocked.qty
        from stock stocked
        where stock.job_no = stocked.job_no
        and qty != 0
        and stock.location <= stocked.location
        order by stocked.location asc
        limit 1
        ) as stocked_qty
        from stock
        order by job_no, location;

        job_no qty location stocked_qty
        ---------- ---------- ---------- -----------
        123 0 loc1 10
        123 0 loc2 10
        123 10 loc3 10
        123 0 loc4 20
        123 0 loc5 20
        123 0 loc6 20
        123 20 loc7 20
        456 0 loc1 20
        456 20 loc2 20


        This may be inefficient as a column subselect. It's important that job_no, qty, and location are all indexed.







        share|improve this answer














        share|improve this answer



        share|improve this answer








        edited Nov 12 '18 at 19:57

























        answered Nov 12 '18 at 19:27









        SchwernSchwern

        89k17101231




        89k17101231



























            draft saved

            draft discarded
















































            Thanks for contributing an answer to Stack Overflow!


            • Please be sure to answer the question. Provide details and share your research!

            But avoid


            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.

            To learn more, see our tips on writing great answers.




            draft saved


            draft discarded














            StackExchange.ready(
            function ()
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53268346%2fsqlite-performing-calculation-on-preceding-rows%23new-answer', 'question_page');

            );

            Post as a guest















            Required, but never shown





















































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown

































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown







            Popular posts from this blog

            How to how show current date and time by default on contact form 7 in WordPress without taking input from user in datetimepicker

            Syphilis

            Darth Vader #20