我有一个类似的查询:
SELECT * FROM table a, table b
WHERE a.col1=b.col1
AND a.col2= b.col2
AND a.col3= b.col3
AND a.col4 = b.col4
AND a.id <> b.id
搜索表格中的重复项。 我需要通过Doctrine 1来查询它,但是会收到错误。这是我的代码:
$q = Doctrine_Query::create()
->from('table a, table b')
->where('a.col1= b.col1')
->andWhere('a.col2= b.col2')
->andWhere('a.col3= b.col3')
->andWhere('a.col4= b.col4')
->andWhere('a.id <> b.id');
,错误是:
"Table" with an alias of "b" in your query does not reference the parent component it is related to.
什么是正确的方法,我需要什么?
答案 0 :(得分:0)
问题是表中没有关系,我在schema.yml中将它添加到我的实体中:
relations:
SomeTable:
class: SomeTable
所以它有效。