Skip site navigation (1) Skip section navigation (2)

sql with postgresql beginner

From: radix(at)ihug(dot)com(dot)au
To: pgsql-novice(at)postgresql(dot)org
Subject: sql with postgresql beginner
Date: 2000-08-30 22:18:30
Message-ID: dt0rqscloep0mtjs0u8as2llfhf5dgijpj@4ax.com (view raw or flat)
Thread:
Lists: pgsql-novice
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
      


pgsql-novice by date

Next:From: Windy ElliottDate: 2000-08-30 22:25:35
Subject: RE: sql with postgresql beginner
Previous:From: Tom LaneDate: 2000-08-30 18:53:13
Subject: Re: Access import

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group