List:General Discussion« Previous MessageNext Message »
From:Marcel Forget Date:May 30 2003 12:17am
Subject:Re: SELECT from multiple tables...
View as plain text  
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" <frak@stripped>
To: <mysql@stripped>
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.
>
>

Thread
SELECT from multiple tables...Mikey29 May
  • Re: SELECT from multiple tables...Marcel Forget30 May
  • Re: SELECT from multiple tables...Marcel Forget30 May
  • can't unzip the mysql V4.1.0phieu huynh30 May
    • Re: can't unzip the mysql V4.1.0Daniel Kasak30 May
  • Re: can't unzip the mysql V4.1.0phieu huynh30 May
    • Re: can't unzip the mysql V4.1.0James Moe30 May
  • Re: can't unzip the mysql V4.1.0Becoming Digital30 May