我想在mysql中使用它:
SELECT * FROM Table1 Where Field1=searchword
OR Field2=searchword
OR Field3=searchword
OR ((SELECT filedx FROM Table2 WHERE fieldxx = Field1) = searchword)
第二选择中的Field1来自第一选择语句。
答案 0 :(得分:0)
我不太确定你想要什么,但看起来你想要匹配
searchword
Table1.Field2
,Table1.Field3
和Table2.filedx
fieldxx=Field1
。表格由SELECT * FROM Table1
LEFT OUTER JOIN Table2 ON (fieldxx=Field1)
WHERE
Field1=searchword
OR Field2=searchword
OR Field3=searchword
OR filedx=searchword;
链接。在这种情况下
你可以做简单的外连接:
{{1}}