From: | "David Olbersen" <DOlbersen(at)stbernard(dot)com> |
---|---|
To: | <pgsql-sql(at)postgresql(dot)org> |
Subject: | Re: Difficult query (for me) |
Date: | 2003-04-07 16:32:29 |
Message-ID: | E7E213858379814A9AE48CA6754F5ECB0D6CE9@mail01.stbernard.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | 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(at)club-internet(dot)fr]
> Sent: Friday, April 04, 2003 12:06 PM
> To: pgsql-sql(at)postgresql(dot)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
>
From | Date | Subject | |
---|---|---|---|
Next Message | David Olbersen | 2003-04-07 16:33:36 | Re: Difficult query (for me) |
Previous Message | Rajesh Kumar Mallah | 2003-04-07 14:27:15 | Re: DBD::Pg transaction issues |