Re: [SQL] Help needed with Window function

2013-10-03 Thread Akihiro Okuno
> This is an approach I also considered, but hoped for a solution without the > expense (albeit small) of having to create a function. How about this query? CREATE TABLE transactions ( item_code text, _date date, qty double precision ) ; INSERT INTO transaction

Re: [SQL] Help needed with Window function

2013-10-02 Thread gmb
David Johnston wrote > Basic idea: use ORDER BY in the window to auto-define a range-preceding > frame. Create an array of all dates (tags in the example) that match with > positive amounts. Negative amounts get their matching tag added to the > array as NULL. The provided function looks into th

Re: [SQL] Help needed with Window function

2013-10-02 Thread David Johnston
gmb wrote > item_code | _date| qty | max > - > ABC | 2013-04-05 | 10.00| 2013-04-05 > ABC | 2013-04-06 | 10.00| 2013-04-06 > ABC | 2013-04-06 | -2.00| 2013-04-06

Re: [SQL] Help needed in skipping column for copy command

2011-01-17 Thread Russell Galyon
COPY D_2147483927_2147484848_TAB ( CP , CPR , CHOUSENO , CSTREET , CLOCALITY , CCITY , CPROVINCE , CCOUNTRY , CZIP ) FROM 'one.txt' WITH DELIMITER ',' QUOTE '"' csv HEADER; On Mon, Jan 17, 2011 at 7:59 AM, Amar Dhol

Re: [SQL] Help needed in skipping column for copy command

2011-01-17 Thread Adrian Klaver
On 01/17/2011 05:59 AM, Amar Dhole wrote: I have table created as follows CREATE TABLE D_2147483927_2147484848_TAB( CP VARCHAR(256) , CPR VARCHAR(256) , CHOUSENO VARCHAR(256) , CSTREET VARCHAR(256) , CLOCALITY VARCHAR(256) , CCITY VARCHAR(256) , CPROVINCE VARCHAR(256) , CCOUNTRY VARCHAR(

[SQL] Help needed in skipping column for copy command

2011-01-17 Thread Amar Dhole
I have table created as follows CREATE TABLE D_2147483927_2147484848_TAB( CP VARCHAR(256) , CPR VARCHAR(256) , CHOUSENO VARCHAR(256) , CSTREET VARCHAR(256) , CLOCALITY VARCHAR(256) , CCITY VARCHAR(256) , CPROVINCE VARCHAR(256) , CCOUNTRY VARCHAR(256) , CZIP VARCHAR(256) , CCO VAR

Re: [SQL] Help needed

2005-11-30 Thread Richard Huxton
NosyMan wrote: Hi everyone, I have some kind of strange problem. I want to build general parametrized trigger for my database. The parameter sent to the trigger contains a column name that trigger should be check. The 'vt' variable contains the column name. In the above statement I want th

[SQL] Help needed

2005-11-30 Thread NosyMan
Hi everyone, I have some kind of strange problem. I want to build general parametrized trigger for my database. The parameter sent to the trigger contains a column name that trigger should be check. CREATE OR REPLACE FUNCTION F_T_IU__check() RETURNS trigger AS $$ DECLARE

[SQL] Help needed

2002-08-28 Thread Mowat, Paul
Dear postgresql, I am just starting to learn SQL. I have attached a script that allows me to create some tables and indexes. I have rows that are inserted into the tables.   I need some help with creating multiple subqueries and table joins, (six or seven table joins). Can you help? Paul Mo

Re: [SQL] Help needed -> ERROR: record arow has no field description

2001-03-02 Thread Tom Lane
Justin Clift <[EMAIL PROTECTED]> writes: > I'm getting this error, which to me makes no sense. Running PostgreSQL > 7.0.3 on Mandrake 7.2 (compiled from source, not the rpms). > ERROR: record arow has no field description Hm. If you don't have any references to "arow.description" then this se

[SQL] Help needed -> ERROR: record arow has no field description

2001-03-02 Thread Justin Clift
Hi all, I'm getting this error, which to me makes no sense. Running PostgreSQL 7.0.3 on Mandrake 7.2 (compiled from source, not the rpms). The code is in a pl/pgsql function I am writing and I can't see why it's complaining. This is the appropriate part of the code : arow