[SQL] fumbling for join syntax

2002-09-05 Thread Daniel Kelley
hi- i have two tables which are used to track questions and answers in a trivia game. the structure of the tables is as follows: CREATE TABLE triv_q_r ( id VARCHAR(10) CONSTRAINT triv_q_r_pkey PRIMARY KEY, t_idVARCHAR(10) CONSTRAINT triv_q_r_t_id_fkey N

Re: [SQL] fumbling for join syntax

2002-09-05 Thread Josh Berkus
Daniel, > select triv_a_r.login as user, count(triv_a_r.login) as score, > sum(triv_a_r.tm)/1000 as time > from triv_a_r LEFT OUTER JOIN triv_q_r ON (triv_a_r.tq_id = > triv_q_r.id) > where triv_a_r.ans = triv_q_r.ans > group by triv_a_r.login > order by score desc, time asc; A little SQL trick:

[SQL] new calculated column

2002-09-05 Thread andres javier garcia garcia
Hi; I've got a table with two fields and about 3000 rows, the second one is a character field, what can have about twenty different values; of course these values are repeated a lot of times in the table. I need to create a new column of type integer, whose value depens on the character fields. T

Re: [SQL] Update help

2002-09-05 Thread Ligia Pimentel
update table1 set price = table2.price where table1.productId = table2.productId; (Of course, both tables must have a different name). :) Ligia ""[EMAIL PROTECTED]"" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > This is a multi-part message in MIME format

Re: [SQL] new calculated column

2002-09-05 Thread mallah
HI. simple (tedious) solution would be do fire 20 sqls.  update tabel set f1= where f2='some varchar1'; update tabel set f1= where f2='some varchar2'; update tabel set f1= where f2='some varchar3'; incase there is some the integer is a function of varchar u may translate to the corresponding

[SQL] Hardware performance for large updates

2002-09-05 Thread Josh Berkus
Folks, I'm doing some massive data transformations on Postgresql, and they're a lot slower than they should be. I'm looking for some tips on improving things. If the PGSQL-PERFORMANCE list was ever created, please tell me and I'll go over there. The update: A series of 7 update statements wh

Re: [SQL] Hardware performance for large updates

2002-09-05 Thread Joe Conway
Josh Berkus wrote: > The problem: The update series (done as a function) takes 10-15 > minutes. During this time, the CPU is never more than 31% busy, only > 256mb of 512 is in use, and the disk channel is only 25% - 50% > saturated.As such, is seems like we could run things faster. > > What