distinct (chain operation 13)


For example, there is the following data in the database table

The following code will return different data in the user_login field

Db::table('think_user')->distinct(true)->field('user_login')->select();

Generated SQL The statement is:

SELECT DISTINCT user_login FROM think_user

Returns the following array

array(2) {
  [0] => array(1) {
    ["user_login"] => string(7) "chunice"
  }
  [1] => array(1) {
    ["user_login"] => string(5) "admin"
  }
}

The parameter of the distinct method is a Boolean value.