Search for field in related table [message #675] |
Tue, 13 March 2007 12:19 |
janalwin
Messages: 17 Registered: May 2006 Location: Groningen
|
Junior Member |
|
|
Hallo,
Is it possible to do a search on a field from a related table?
I have a table with product,brands, and products_brands. Some products are conversion sets for other brands. These relations are placed in product_brands.
If i search a brand, I also want to find the conversionsets for this brand.
This is a simplefied version what i've tried to do:
$sql_from= "product LEFT JOIN products_brands ON product.product_id=product_brands.product_id ";
....
$where="brand_id='2' OR products_brands.brand_id='2'"
$x=getData($where)
The product_brands.brands_id part seems to get lost in the _sqlAssembleWhere function of std.table.class.inc.
I've tried adding a fieldspec for products_brands.brand_id to the product table, but this didn't help.
|
|
|