fix sql error

This commit is contained in:
wlx 2013-10-22 14:42:10 +00:00
parent 3628ece4c1
commit a4f5c42739
1 changed files with 2 additions and 2 deletions

View File

@ -233,7 +233,7 @@ class Reference
public function fetchTodoReferences() public function fetchTodoReferences()
{ {
$wheresql = array(); $wheresql = array();
$wheresql[]=" r.uuid is not null "; $wheresql[]=" ref.id not in (select distinct refid from mdref) ";
if(!empty($this->keyword)) if(!empty($this->keyword))
{ {
$wheresql[] = " (ref.title LIKE '%{$this->keyword}%' OR ref.reference LIKE '%{$this->keyword}%') "; $wheresql[] = " (ref.title LIKE '%{$this->keyword}%' OR ref.reference LIKE '%{$this->keyword}%') ";
@ -252,7 +252,7 @@ class Reference
$order = "ref.{$this->order} {$this->sort}"; $order = "ref.{$this->order} {$this->sort}";
} }
$sql="select distinct ref.* from mdref r left join {$this->table->reference} ref on r.refid=ref.id $sql="select distinct ref.* from {$this->table->reference} ref
$wheresql $wheresql
ORDER BY $order"; ORDER BY $order";
$rs=$this->db->query($sql); $rs=$this->db->query($sql);