選擇從一列只有唯一值我有這樣在笨
name|subjects|location
......................
BUET|CSE|Dhaka
BUET|EEE|Dhaka
RUET|CE |Rajshahi
RU |CE |Rajshahi
表這裏所有行distinct.And如果我使用
$this->db->select('*') and $this->db->distinct()
,將選擇的所有行BUET但我只想要這樣
name|subjects|location
......................
BUET|CSE|Dhaka
RUET|CE |Rajshahi
RU |CE |Rajshahi
這意味着只有第一列必須是不同的,並選擇所有的列作爲我們如果我使用$ this-> db-> select('name')和$this->db->distinct()
,它會起作用。那麼關於其他專欄的內容呢?
由於我的原始表有很多列,所以我想使用$this->db->select('*')
。我認爲$this->db->distinct()
不會將任何列作爲參數。它基於select來區分結果。我怎樣才能做到這一點?
使用'DISTINCT'查詢。 –