Skip to content

Create Implementing Balance Sheets in PostgreSQL.md#15

Open
dora-su wants to merge 3 commits intopavanagrawal123:masterfrom
dora-su:patch-1
Open

Create Implementing Balance Sheets in PostgreSQL.md#15
dora-su wants to merge 3 commits intopavanagrawal123:masterfrom
dora-su:patch-1

Conversation

@dora-su
Copy link
Copy Markdown

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

A gallery entry on making balance sheets using PostgreSQL.

@pavanagrawal123
Copy link
Copy Markdown
Owner

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

@dora-su
Copy link
Copy Markdown
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
Copy Markdown
Owner

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

@pavanagrawal123
Copy link
Copy Markdown
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
Copy Markdown
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