beerguzler
04-13-2007, 04:19 AM
Hi,
I have been racking my brains on this .
I have 3 tables where Product col is the same across all 3.
Tables
id /Product / Price
So far I have been using
$query = "Select `product`, `price` as p, 'tbl1' as n from `tbl1` where `product` REGEXP '".$trimmed."'
UNION ALL
Select `product`, `price` as p, 'tbl2' as n from `tbl2` where `product` REGEXP '".$trimmed."'
UNION ALL
Select `product`, `price` as p, 'tbl3' as n from `tbl3` where `product` REGEXP '".$trimmed."' ORDER by `name`";
Output gives me
Product | vendor | Price
Wanting to do a search where product is combine from all 3 tables and prices in different colums - >output
Product | Price (tbl1) | Price (tbl2) | Price (tbl3)
Any idea's ?
I have been racking my brains on this .
I have 3 tables where Product col is the same across all 3.
Tables
id /Product / Price
So far I have been using
$query = "Select `product`, `price` as p, 'tbl1' as n from `tbl1` where `product` REGEXP '".$trimmed."'
UNION ALL
Select `product`, `price` as p, 'tbl2' as n from `tbl2` where `product` REGEXP '".$trimmed."'
UNION ALL
Select `product`, `price` as p, 'tbl3' as n from `tbl3` where `product` REGEXP '".$trimmed."' ORDER by `name`";
Output gives me
Product | vendor | Price
Wanting to do a search where product is combine from all 3 tables and prices in different colums - >output
Product | Price (tbl1) | Price (tbl2) | Price (tbl3)
Any idea's ?