Re: Difficult query (for me)
От | David Olbersen |
---|---|
Тема | Re: Difficult query (for me) |
Дата | |
Msg-id | E7E213858379814A9AE48CA6754F5ECB0D6CE9@mail01.stbernard.com обсуждение исходный текст |
Ответ на | Difficult query (for me) (sylfanie@club-internet.fr (Stephane)) |
Список | pgsql-sql |
Stephane, SELECT table1.recordname, table1.value - table2.value FROM table1, table2 WHERE table1.recordname = table2.recordname Right? -------------------------- David Olbersen iGuard Engineer 11415 West Bernardo Court San Diego, CA 92127 1-858-676-2277 x2152 > -----Original Message----- > From: Stephane [mailto:sylfanie@club-internet.fr] > Sent: Friday, April 04, 2003 12:06 PM > To: pgsql-sql@postgresql.org > Subject: [SQL] Difficult query (for me) > > > Hello, > > Basicaly I have two tables like this: > > Table 1 > RecordName Value > a 100 > b 100 > c 100 > d 100 > e 100 > f 100 > > Table 2 > RecordName Value > a 25 > b 50 > c 75 > g 150 > h 150 > > I would like a query that give me a result like this: > a 75 (100-25) > b 50 (100-50) > c 25 > d 100 > e 100 > f 100 > g -150 > h -150 > > It is table1-table2. > I could do it for records a,b,c but I do not how to have record which > are only in one of the two tables. > Thanks for your help. > Stephane. > > > ---------------------------(end of > broadcast)--------------------------- > TIP 4: Don't 'kill -9' the postmaster >
В списке pgsql-sql по дате отправления: