MySQL Forums
Forum List  »  InnoDB

How make this
Posted by: Alvaro Iark
Date: September 09, 2008 01:37PM

the following sql was done in Oracle, is a way to make in MySQL?

WITH my_table
AS (SELECT 1 doc, 'something' historic, 5 debit, 0 credit from dual UNION ALL
SELECT 2 doc, 'something' historic, 5 debit, 0 credit from dual UNION ALL
SELECT 3 doc, 'something' historic, 0 debit, 8 credit from dual UNION ALL
SELECT 4 doc, 'something' historic, 0 debit, 15 credit FROM dual)
-- END OF TEST DATA SETUP **** NOW TO THE QUERY WE'RE INTERESTED IN:
SELECT
doc,
historic,
debit,
credit,
Sum(debit - credit) over (order by doc) balance
FROM
my_table;

Options: ReplyQuote


Subject
Views
Written By
Posted
How make this
2629
September 09, 2008 01:37PM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.