Re: Fields from different tables

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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
BAE44F10.2AF8%grillen@abendstille.at">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



-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux