| Searching Two Mysql Tables
|
matthewamzn

msg:3875307 | 4:50 pm on Mar 20, 2009 (gmt 0) | How can I combine two searches from different tables into one query? $query_one = "SELECT * FROM `v_inv` WHERE MATCH (color,make,model,intcolor,category) AGAINST ('{$search}') AND public = 1 ORDER BY date"; $query_two = "SELECT * FROM `v_pvi` WHERE MATCH (color,make,model,intcolor,category) AGAINST ('{$search}') AND public = 1 ORDER BY date";
|
LifeinAsia

msg:3875311 | 5:00 pm on Mar 20, 2009 (gmt 0) | SELECT * FROM `v_pvi` WHERE MATCH (color,make,model,intcolor,category) AGAINST ('{$search}') AND public = 1 UNION SELECT * FROM `v_pvi` WHERE MATCH (color,make,model,intcolor,category) AGAINST ('{$search}') AND public = 1 The field names must be identical in each table. Otherwise, just select the fields that do have identical names (or use aliases).
|
|
|