从多个表中获取数据时sql查询出错

时间:2013-02-06 05:09:46

标签: mysql

select name from tbl_bracelets b, tbl_brooch br where b.name or br.name ='Diamond Necklce'

$res=mysql_query($qry);

上述Sql查询中有一个错误,我无法找到...请帮我解决此问题。

由于

2 个答案:

答案 0 :(得分:0)

也许你需要这个?

select name
from tbl_bracelets b, tbl_brooch br
where b.name = br.name
   or br.name ='Diamond Necklce'

答案 1 :(得分:0)

试试这个..

  select b.name from tbl_bracelets b, tbl_brooch br where b.name='Diamond Necklce' or br.name='Diamond Necklce' 

select    name 
from     tbl_bracelets where name='Diamond Necklce'

union

select   name 
from     tbl_brooch where name='Diamond Necklce'