You are here: Re: Join with many parts into only 1 request « PHP SQL « IT news, forums, messages
Re: Join with many parts into only 1 request

Posted by Guy on 02/19/06 13:00

leupat a écrit :
> Hello everybody !!
>
> I have a little problem with request.
>
> I have 2 tables like that :
>
> Table 1: T_Product
> IdProduct
> ProductName
> IdSupplierPart1
> IdSupplierPart2
> IdSupplierPart3
> ...
> IdSupplier10
>
> Table 2: T_Supplier
> IdSupplier
> SupplierName
> Adress
> ...
>
> For one product we can have many supplier.
>
> How to received its name(ProductName) and names of each suppliers
> (SupplierName) for 1 product into only 1 request ??
>
> Thanks
> Best regards.
Bonjour,


with union (but some limits ???)


select ProductName, SupplierName from T_product,T_Supplier where
IdSupplierPart1=IdSupplier
union
select ProductName, SupplierName from T_product,T_Supplier where
IdSupplierPart2=IdSupplier
union
select ProductName, SupplierName from T_product,T_Supplier where
IdSupplierPart3=IdSupplier
...
...
...
union
select ProductName, SupplierName from T_product,T_Supplier where
IdSupplierPart10=IdSupplier
order by ProductName, SupplierName;

GR

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация