我的控制器中有两个查询
if (isset($input['council']) && $input['council'] != '')
{
$query = $query->join('suburb_near', 'titles.suburb', '=', 'suburb_near.suburb')
->select(array('titles.*', 'suburb_near.suburb' , 'suburb_near.council'))
->where('council', 'like', '%'. $input['council'].'%')
->orderBy('views', 'desc');
}
if (isset($input['country']) && $input['country'] != '')
{
$query = $query->join('suburb_near', 'titles.suburb', '=', 'suburb_near.suburb')
->select(array('titles.*', 'a.suburb' , 'suburb_near.country'))
->where('country', 'like', '%'. $input['country'].'%')
->orderBy('views', 'desc');
}
Run Code Online (Sandbox Code Playgroud)
如果我独立运行,它们运行良好。但是如果我同时运行两者,我会收到一个错误:1066 Not unique table/alias
我应该如何改变这个?