Re: Multi Table Query Help
From: Steve Edwards (racquetballer_at_hotmail.com)
Date: 12/20/04
- Next message: Michael Fesser: "Re: Leech (?) content of mySQL tables"
- Previous message: knoak: "Leech (?) content of mySQL tables"
- In reply to: Pedro Graca: "Re: Multi Table Query Help"
- Next in thread: Pedro Graca: "Re: Multi Table Query Help"
- Reply: Pedro Graca: "Re: Multi Table Query Help"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Mon, 20 Dec 2004 09:02:07 -0800
"Pedro Graca" <hexkid@dodgeit.com> wrote in message
news:slrncsde53.eqs.hexkid@ID-203069.user.uni-berlin.de...
> Steve wrote:
> > The two tables are product and vendor. A vendor can be a manufacturer,
> > distributor, or both. This is indicated via the manufacturer_YN and
> > distributor_YN fields in the vendor table, and vendor_id is an
> > auto_number field. In the product table, there is a manufacturer_id and
> > a distributor_id field, and these are linked to the vendor.vendor_id
> > field.
> >
> > What I would like to do is for each product, display the name, short
> > description (both fields in product table), manufacturer, and
> > distributor. The problem I'm having is writing a query to get all this
> > info at once so it can be displayed.
>
> Please post your tables definition (use the output of the DESCRIBE
> command).
mysql> describe vendor
-> ;
+-------------------+-----------------------------
---+
Field | Type
|
-----------------+---------------
----------+
vendor_id | mediumint(5) u
increment |
name | varchar(50)
|
address | varchar(30)
|
city | varchar(20)
|
state | char(2)
|
zip | mediumint(5)
|
phone | varchar(10)
|
fax | varchar(10)
|
email | varchar(50)
|
url | varchar(80)
|
contact_name | varchar(30)
|
acct_num | varchar(22)
|
distributor_YN | enum('Y','N')
|
manufacturer_YN | enum('Y','N')
mysql> describe product
-> ;
+-------------------+-----------------------------
---+
| Field | Type
ra |
+-------------------+-----------------------------
---+
| product_sku | bigint(9) unsigned zerofill
|
| subcategory2 | varchar(30)
|
| product_name | varchar(50)
|
| short_description | varchar(80)
|
| long_description | text
|
| picture_name | varchar(16)
|
| manufacturer_id | mediumint(5) unsigned
|
| distributor_id | mediumint(5) unsigned
Thanks.
Steve
- Next message: Michael Fesser: "Re: Leech (?) content of mySQL tables"
- Previous message: knoak: "Leech (?) content of mySQL tables"
- In reply to: Pedro Graca: "Re: Multi Table Query Help"
- Next in thread: Pedro Graca: "Re: Multi Table Query Help"
- Reply: Pedro Graca: "Re: Multi Table Query Help"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|