From: | "John" <radix(at)ihug(dot)com(dot)au> |
---|---|
To: | <pgsql-novice(at)postgresql(dot)org> |
Subject: | Re: sql with postgresql beginner |
Date: | 2000-08-30 22:44:18 |
Message-ID: | 002c01c012d3$d6232200$0301a8c0@ihug.com.au |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-novice |
I just got it with
select list.item, vendors.vendorname
from list, vendors
where list.vendorcode = 101 and vendors.vendorcode = 101;
I thought that the 'from' clause was a join?
Back to the docs for me I think.
----- Original Message -----
From: Windy Elliott <windye(at)softshare(dot)com>
To: <radix(at)ihug(dot)com(dot)au>
Cc: <pgsql-novice(at)postgresql(dot)org>
Sent: Thursday, August 31, 2000 7:55 AM
Subject: RE: [NOVICE] sql with postgresql beginner
> I am a begginer as well, but I am under the impression that you actually
> need to join the tables.
>
> select list.item, vendors.vendorname from list LEFT JOIN vendors ON
> list.vendorcode = vendors.vendorcode where list.vendorcode = 101;
>
> This is how I would do it. If I am wrong, please, someone correct me.
>
> Windy
>
> -----Original Message-----
> From: radix(at)ihug(dot)com(dot)au [mailto:radix(at)ihug(dot)com(dot)au]
> Sent: Wednesday, August 30, 2000 3:19 PM
> To: pgsql-novice(at)postgresql(dot)org
> Subject: [NOVICE] sql with postgresql beginner
>
>
> Could somebody comment on why my SQL query hasn't produced the desired
> result (apart from pointing out that my SQL skills suck)
>
>
> I've listed the two tables I'm using (created them from an example
> article at www.networkcomputing.com) and the select statement which
> isn't producing the correct result.
>
>
> list table
> ==========
> item | vendorcode | quantity
> -------------+------------+----------
> Root Beer | 100 | 3
> Ice Cream | 100 | 1
> Napkins | 101 | 50
> Spark Plugs | 102 | 4
>
>
> vendors table
> =============
> vendorcode | vendorname
> ------------+---------------------------
> 100 | Super Grocer
> 101 | Genernal Department Store
> 102 | General Auto Parts
>
>
> Now here's the select statement which I thought should produce just
> one row containing "Napkins | Genernal Department Store"
>
> select list.item, vendors.vendorname
> from list, vendors
> where list.vendorcode = 101;
> item | vendorname
> ---------+---------------------------
> Napkins | Super Grocer
> Napkins | Genernal Department Store
> Napkins | General Auto Parts
>
>
From | Date | Subject | |
---|---|---|---|
Next Message | ghaverla | 2000-08-30 23:23:14 | Re: 7.0.2 regressions testing on Sparc running 2.5.1 |
Previous Message | Windy Elliott | 2000-08-30 22:25:35 | RE: sql with postgresql beginner |