From a4f5c42739f53ee7cd04c9217696c955f22173de Mon Sep 17 00:00:00 2001 From: wlx Date: Tue, 22 Oct 2013 14:42:10 +0000 Subject: [PATCH] fix sql error --- application/module/Reference/Reference.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/application/module/Reference/Reference.php b/application/module/Reference/Reference.php index 6fd1eb0c..01c4b54f 100644 --- a/application/module/Reference/Reference.php +++ b/application/module/Reference/Reference.php @@ -233,7 +233,7 @@ class Reference public function fetchTodoReferences() { $wheresql = array(); - $wheresql[]=" r.uuid is not null "; + $wheresql[]=" ref.id not in (select distinct refid from mdref) "; if(!empty($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}"; } - $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 ORDER BY $order"; $rs=$this->db->query($sql);