Sorry, I missed the last part of your email.

Try:

SELECT * FROM products p, uses u, prod_uses pu WHERE p.pid=pu.pid AND
u.uid=pu.uid AND uses='use 1';

:-)
----- Original Message ----- 
From: "Marcel Forget" <[EMAIL PROTECTED]>
To: "Mikey" <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]>
Sent: Thursday, May 29, 2003 8:17 PM
Subject: Re: SELECT from multiple tables...


> Hi,
>
> It would work something like this:
> SELECT * FROM products p, uses u, prod_uses pu WHERE p.pid=pu.pid AND
> u.uid=pu.uid AND productname='product 1';
>
> Where
>
> products
> pid int(11) PRI (NULL) auto_increment
> productname varchar(25) YES (NULL)
>
> uses
> uid int(11) PRI (NULL) auto_increment
> uses varchar(25) YES (NULL)
>
> prod_uses
> pid int(11) 0
> uid int(11) 0
>
> I hope this works out for you.
>
> Marcel
> ----- Original Message ----- 
> From: "Mikey" <[EMAIL PROTECTED]>
> To: <[EMAIL PROTECTED]>
> Sent: Thursday, May 29, 2003 12:54 PM
> Subject: SELECT from multiple tables...
>
>
> > Hi NG, this is my first visit here, so please be gentle!!!
> >
> > I have a table of products (`prods`), and a separate table of product
uses
> > (`uses`) and the products are linked to their uses by a list
> (`prod_uses`).
> >
> > What I need to be able to do is allow a search of products by their use
> and
> > I am getting a bit stuck on writing the where clause.  I know that for a
> > simple join I can use:  SELECT * FROM table1, table2, WHERE
> > table1.field=table2.field2 AND table2.field2='value' - but how do I make
a
> > join that will get back all products with a specified application?
> >
> > Many thanks for your help and time...
> > regards,
> >
> > Mikey
> > - In theory, theory and practice should be the same, in practice it
isn't.
> >
> >
>
>
> -- 
> MySQL General Mailing List
> For list archives: http://lists.mysql.com/mysql
> To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]
>


-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]

Reply via email to