Re: Difficult query (for me)

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:33:36
Message-ID: E7E213858379814A9AE48CA6754F5ECB0D6CEA@mail01.stbernard.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

Stephane,

Sorry, further reading shows me that I'm dumb and you can already do this.

--------------------------
David Olbersen
iGuard Engineer
11415 West Bernardo Court
San Diego, CA 92127
1-858-676-2277 x2152

> -----Original Message-----
> From: David Olbersen
> Sent: Monday, April 07, 2003 9:32 AM
> To: pgsql-sql(at)postgresql(dot)org
> Subject: RE: [SQL] Difficult query (for me)
>
>
> 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
> >
>

Browse pgsql-sql by date

  From Date Subject
Next Message Rod Taylor 2003-04-07 16:48:56 Re: Creating a foreign key on the Union of two tables
Previous Message David Olbersen 2003-04-07 16:32:29 Re: Difficult query (for me)