Re: [GENERAL] question about query

2011-07-01 Thread David Johnston
-Original Message- i have created the union to get all the records (giving payments negative sign) but what i don't know how to do it is use a window function to create the column with the running total, any short example of syntax please? >> You'll need to check the documentation

Re: [GENERAL] question about query

2011-06-30 Thread Linos
El 30/06/11 15:44, David Johnston escribió: Original Message- From: pgsql-general-ow...@postgresql.org [mailto:pgsql-general-ow...@postgresql.org] On Behalf Of Linos Sent: Thursday, June 30, 2011 9:00 AM To: pgsql-general@postgresql.org Subject: [GENERAL] question about query Hi,

Re: [GENERAL] question about query

2011-06-30 Thread Linos
El 30/06/11 15:44, David Johnston escribió: Original Message- From: pgsql-general-ow...@postgresql.org [mailto:pgsql-general-ow...@postgresql.org] On Behalf Of Linos Sent: Thursday, June 30, 2011 9:00 AM To: pgsql-general@postgresql.org Subject: [GENERAL] question about query Hi,

Re: [GENERAL] question about query

2011-06-30 Thread David Johnston
Original Message- From: pgsql-general-ow...@postgresql.org [mailto:pgsql-general-ow...@postgresql.org] On Behalf Of Linos Sent: Thursday, June 30, 2011 9:00 AM To: pgsql-general@postgresql.org Subject: [GENERAL] question about query Hi, i am trying to obtain from the database what

Re: [GENERAL] question about query

2011-06-30 Thread Linos
sorry, i have more searching for a way to do something like this but i should have posted the tables anyway, i have any more documents but all have a structure like this: invoices: CREATE TABLE factura ( id_factura serial NOT NULL, -- invoice id id_cliente integer NOT NULL, -- customer

Re: [GENERAL] question about query

2011-06-30 Thread Craig Ringer
On 30/06/2011 9:00 PM, Linos wrote: how could i calculate this pending column that does not exists in the database and i need to be based on last result row? I would like to get with raw SQL but the need to use any procedural language would not be a problem. Without knowing how you've structu

Re: [GENERAL] Question about query optimization

2006-11-15 Thread Gurjeet Singh
On 11/15/06, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: Hello Gurjeet!   Tried your suggestion but this is just a marginal improvement. Our query needs 126 ms time, your query 110 ms. I do not see an index access on the component table Do you have an index on component.component_id?

Re: [GENERAL] Question about query optimization

2006-11-15 Thread Gurjeet Singh
On 11/15/06, Gurjeet Singh <[EMAIL PROTECTED]> wrote: On 11/15/06, [EMAIL PROTECTED] < [EMAIL PROTECTED]> wrote: Is there any other, and more performat way, to get the last history entryfor a given date than this query?  Create an (independent) index on history_timestamp column and use a min/max i

Re: [GENERAL] Question about query optimization

2006-11-15 Thread Matthias . Pitzl
: Wednesday, November 15, 2006 4:18 PMTo: [EMAIL PROTECTED]Cc: pgsql-general@postgresql.orgSubject: Re: [GENERAL] Question about query optimizationOn 11/15/06, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: Is there any other, and more performat way, to get the last history entr

Re: [GENERAL] Question about query optimization

2006-11-15 Thread Gurjeet Singh
On 11/15/06, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: Is there any other, and more performat way, to get the last history entryfor a given date than this query? Create an (independent) index on history_timestamp column and use a min/max in the subquery.More specifically, your query should look