How to Write Distinct Query in CodeIgniter?

Today, We want to share with you distinct codeigniter.In this post we will show you codeigniter get_where multiple conditions, hear for sql unique count and use distinct in sql we will give you demo and example for implement.In this post, we will learn about Sql Unique Count And Use Distinct In Sql with an example.

get_where codeigniter Code Example

Distinct in Codeigniter Query

$where_array = array(
               'email'=>'[email protected]',
$shop_name = "members";
$limit = 10;
$offset = 0;
$query = $this->db->get_where($shop_name,$where_array, $limit, $offset);

Using distinct() Method

$query = $this->db->get('Members');

// Generates SQL String
// SELECT DISTINCT `Level` FROM `Members`;

Using DISTINCT Keyword in Select() Method:

$query = $this->db->get('Members');

// Generates SQL String
// SELECT DISTINCT(Level) FROM `Members`;

distinct() Query in Codeigniter

// Produces: SELECT DISTINCT * FROM shop


$record = '123';



$this->db->where('record', $record); 

$query = $this->db->get('accesslog');

get Num Rows

I hope you get an idea about distinct codeigniter.
I would like to have feedback on my blog.
Your valuable feedback, question, or comments about this article are always welcome.
If you enjoyed and liked this post, donโ€™t forget to share.