Re: [SQL] Need SQL Help Finding Current Status of members

2005-12-15 Thread Michael Fuhr
On Thu, Dec 15, 2005 at 08:31:09PM -0500, Michael Avila wrote: > What I want to do is find the latest status for each member. Actually I want > to find all those with an status of "A". But it must be the current (latest) > status. How do I find the most current date for each member in a pile of > m

[SQL] Need SQL Help Finding Current Status of members

2005-12-15 Thread Michael Avila
I have a table which keeps track of the status of members. In the table is member_id int(8) status_code char(1) status_date date KEY member_id (member_id,status_code,status_date) Each member can have multiple records because a record is added each time the status changes but the old record i

Re: [SQL] Defaulting a column to 'now'

2005-12-15 Thread Ken Winter
Thanks, Tom (also Keith Worthington and Bricklen Anderson). That works. ~ Ken > -Original Message- > From: Tom Lane [mailto:[EMAIL PROTECTED] > Sent: Wednesday, December 14, 2005 1:15 PM > To: Ken Winter > Cc: PostgreSQL pg-sql list > Subject: Re: [SQL] Defaulting a column to 'now' > >

Re: [SQL] RETURN SET OF DATA WITH CURSOR

2005-12-15 Thread Richard Huxton
grupos wrote: Hi Richard, Thanks for your promptly answer. I don't have experience returning refcursor but my choice would be it. > I read the documentation but I didn't find any example with my necessity... http://www.postgresql.org/docs/8.1/static/plpgsql-cursors.html#PLPGSQL-CURSOR-USING

Re: [SQL] RETURN SET OF DATA WITH CURSOR

2005-12-15 Thread grupos
Hi Richard, Thanks for your promptly answer. I don't have experience returning refcursor but my choice would be it. I read the documentation but I didn't find any example with my necessity... Could you give me a small example on the same "basis" that I want? Thanks, Rodrigo Carvalhaes Richa

Re: [SQL] RETURN SET OF DATA WITH CURSOR

2005-12-15 Thread Richard Huxton
grupos wrote: Hi ! I am making one plpgsql function and I need to return of setof data using a cursor. The problem is that my function is returning only the first row and column of the query. This query have more than 80 columns and 1.000 rows. Enyone have any tip to give me? Yes - decide

Re: [SQL] selective updates

2005-12-15 Thread Gianluca Riccardi
Gianluca Riccardi wrote: [cut] solved, i used a function giving as result the wanted value from table2.column1 in a UPDATE table1 SET column4=(my_personal_func()) WHERE 'cirteria on table1.column2 table2.column2' ; sorry for making you wasting your time Gianluca Riccardi ---

[SQL] RETURN SET OF DATA WITH CURSOR

2005-12-15 Thread grupos
Hi ! I am making one plpgsql function and I need to return of setof data using a cursor. The problem is that my function is returning only the first row and column of the query. This query have more than 80 columns and 1.000 rows. Enyone have any tip to give me? Here the fuction... CREATE

[SQL] selective updates

2005-12-15 Thread Gianluca Riccardi
sorry for posting a new opening 'thread', but my subscribing to the ml is later than a post with the subject 'APPEND INTO?' dated Thu, 01 Dec 2005 10:32:08 -0500 so i can't make reply to that. follows a copy of that post Mark Fenbers writes: I want to SELECT INTO mytable WHERE (criteria are m