Re: [SQL] Complicated "group by" question

2004-09-02 Thread Jeff Boes
Andrew Perrin wrote: I have a table of people ("reviewers"), a table of review assignments ("assign"), and a table of review acceptances ("accept"). I would like to be able to write a query to return the latest (e.g., max(assign_date)) assignment for each reviewer, plus the acc_id field from "accep

Re: [SQL] PRIMARY KEY and INDEX

2004-09-02 Thread Devrim GUNDUZ
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Hi, On Thu, 2 Sep 2004, Nosyman wrote: It is necessary to define an index for a primary key column? Let's have an example CREATE TABLE users( id_user INTEGER PRIMARY KEY, user_name VARCHAR(25) ); Does PgSQL automatically create an index for id_user (pri

Re: [SQL] PRIMARY KEY and INDEX

2004-09-02 Thread Achilleus Mantzios
O kyrios Nosyman egrapse stis Sep 2, 2004 : > It is necessary to define an index for a primary key column? > > Let's have an example > CREATE TABLE users( > id_user INTEGER PRIMARY KEY, > user_name VARCHAR(25) > ); > > Does PgSQL automatically create an index for id_user (primary key) or it > mu

[SQL] PRIMARY KEY and INDEX

2004-09-02 Thread Nosyman
It is necessary to define an index for a primary key column? Let's have an example CREATE TABLE users( id_user INTEGER PRIMARY KEY, user_name VARCHAR(25) ); Does PgSQL automatically create an index for id_user (primary key) or it must be created by hand? Thanks

Re: [SQL] copy old column's values to new column

2004-09-02 Thread Bruno Wolff III
On Thu, Sep 02, 2004 at 06:16:47 -0700, [EMAIL PROTECTED] wrote: > Hello, > > I need some basic SQL help. I added a new column to an existing table, > and now I need to copy values from one of the old columns to this new > columns. > > I need something like this: > > FOR pvId IN SELECT id FRO

[SQL] copy old column's values to new column

2004-09-02 Thread ogjunk-pgjedan
Hello, I need some basic SQL help. I added a new column to an existing table, and now I need to copy values from one of the old columns to this new columns. I need something like this: FOR pvId IN SELECT id FROM preference_value LOOP update preference_value SET display_value = (select v