1

Can someone please help me in converting the below oracle query into something which I can use on MySql 5.6 using session variables etc.

SELECT mei.ID, 
    COUNT(*) OVER(
        PARTITION BY mei.accnt, mei.SUBTRANTYPEID 
        ORDER BY EVENTDATE ASC ROWS UNBOUNDED PRECEDING
    ) 
FROM Cart_INQUIRY mei, CART_INQUIRY_WORKING miw 
WHERE 
    mei.accnt in ('18062834541') and 
    mei.ID=miw.INQUIRYID and 
    miw.SUBTRANSTSID!='LoadedInError';
jfc
  • 180
  • 1
  • 11
Naxi
  • 1,504
  • 5
  • 33
  • 72
  • You need to be more specific about your problem. What did you try? Can you show us some code? Please [read how to ask a good question](https://stackoverflow.com/help/how-to-ask) then edit your question to improve it. Thank you! – Shanteshwar Inde Mar 28 '19 at 11:34
  • `PARTITION BY` can be trickly to simulate with MySQL user variables especially with options like `UNBOUNDED PRECEDING`, i advice upgrading the old version to MySQL 8 if possible. – Raymond Nijland Mar 28 '19 at 11:37
  • possible duplicate https://dba.stackexchange.com/questions/94545/calculate-row-value-based-on-previous-and-actual-row-values – vishal Mar 28 '19 at 11:39
  • or this https://stackoverflow.com/questions/17664436/cumulative-sum-over-a-set-of-rows-in-mysql – vishal Mar 28 '19 at 12:06

0 Answers0