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

2005-12-16 Thread Michael Avila
Just tried it and it returned nothing. > > Select * from memberstatus A where not exists > >(select * from emberstatus B where B.member_id=A.member_id and > > B.status_date >A.status_date) Why the WHERE NOT EXISTS? Here is a copy and paste of my code $query = "SELECT * FROM memberstatus A W

Re: [SQL] Help on function creating

2005-12-16 Thread Alexandre Gonçalves Jacarandá
Guys, I can do what I need but I have other problem: How can I named columns with another data ? For example: select * from crosstab('select pessoa_nome(ref_pessoa), ref_disciplina, nota_final from matricula where ref_periodo = ''25CASI'' order by 1,2', 'select ref_disciplina from disciplinas_ofer

[SQL] Rule causes baffling error

2005-12-16 Thread Ken Winter
I'm trying to figure out why a rule gives me a uniqueness violation when I try to do an update. I have a table, "my_data", defined as: create table my_data ( id INT8 not null default nextval('person_seq'), effective_date_and_time TIMESTAMP WITH TIME ZONE not null default CURRENT_T

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

2005-12-16 Thread Alvaro Herrera
Michael Avila wrote: > Interesting. I think I understand that. I have never worked with a SELECT > within a SELECT (I think that is called a subquery). I am guessing that it > works its way through the member status records until the latest date > "floats" to the top (nothing is > than it). > > Wil

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

2005-12-16 Thread Michael Avila
Interesting. I think I understand that. I have never worked with a SELECT within a SELECT (I think that is called a subquery). I am guessing that it works its way through the member status records until the latest date "floats" to the top (nothing is > than it). Will that be a problem performance-

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

2005-12-16 Thread Patrick JACQUOT
Richard Huxton wrote: Michael Avila wrote: 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

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

2005-12-16 Thread Richard Huxton
Michael Avila wrote: 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 chan

Re: [SQL] RETURN SET OF DATA WITH CURSOR

2005-12-16 Thread Patrick JACQUOT
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... Could you give me a small example on the same "basis" that I want? Thanks, Rodrigo