Re: Fields from different tables
| From: | Dani Matielo | Date: | Sun, 11 May 2003 17:47:35 +0000 |
| Subject: | Re: Fields from different tables | ||
| References: | 1 2 | Groups: | php.db |
| Request: | Send a blank email to php-db+get-27650@lists.php.net to get a copy of this message | ||
Hi,
it worked well, thanx... but I have 2 more questions:
1) I've seen around there a LEFT JOIN thing... what is this about?
2) At the end part (WHERE category.id=product.id_category) can I add other
conditions, like WHERE category.id=product.id_category AND product.id=1, for
example?
Thank you, :)
Dani
>
"Heilo" <grillen@abendstille.at> escreveu na mensagem
news:BAE44F10.2AF8%grillen@abendstille.at...
> hi!
>
> you can do it this way:
>
> SELECT
> product.id,
> product.name,
> category.name AS cat_name
> FROM
> product,
> category
> WHERE
> category.id=product.id_category
>
> hope this works?
>
> .ma
>
> Dani Matielo <dmatielo@uol.com.br> wrote@11.05.2003 18:59 Uhr:
>
> > Ok, this problem is a little more complicate: I have 2 diferente tables,
say
> > product and category. In product I have fields
> >
> > id
> > name
> > id_category
> >
> > and in category I have fields
> > id
> > name
> >
> > Well, obviously, the field 'id_category' in product refers to the field
'id'
> > in the table category. Very well. Now I am making an array with my
products
> > but instead of the field 'id_category' I would like the name of the
category
> > to appear in the array...
> >
> > How do I do that? :(
> >
> > Dani
> > Who's still in PHP basics...
> >
> >
> > ---
> > Outgoing mail is certified Virus Free.
> > Checked by AVG anti-virus system (http://www.grisoft.com).
> > Version: 6.0.476 / Virus Database: 273 - Release Date: 24/4/2003
> >
> >
>
---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.476 / Virus Database: 273 - Release Date: 24/4/2003