Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create Implementing Balance Sheets in PostgreSQL.md #15

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

dora-su
Copy link

@dora-su dora-su commented Nov 29, 2018

A gallery entry on making balance sheets using PostgreSQL.

@pavanagrawal123
Copy link
Owner

This is pretty cool. Can you try implementing with the lag function, it'll make your code more concise!

@dora-su
Copy link
Author

dora-su commented Nov 29, 2018

Hi!
Actually, I initially planned to use the lag function, however, I ran it on my table and it would always return the default value. Thus, I decided to use a temporary table even though it may not be the most efficient and concise. I'm not sure of the reason for why the lag function will not work for me. It'd be great if you could send some help since I'm quite new to this!
Thank you.

@pavanagrawal123
Copy link
Owner

Sure I can help out. What exact commands were you using with the lag function?

@pavanagrawal123
Copy link
Owner

I will also go ahead and accept the GCI task, right after you fix the title. The current title in the markdown file does not follow the hugo syntax. You can look on the example to see the correct format.

@dora-su
Copy link
Author

dora-su commented Nov 30, 2018

Hi! I updated the title to match the table from the example. Let me know if it still needs fixing. Here is my original use of the lag function:

UPDATE "BalanceSheet" 
	SET "Balance" = (SELECT LAG ("Balance", 1, 0.0) OVER (ORDER BY "Date" ASC)) + "Credit (+)" - "Debit (-)"; 

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants