I am joining 2 tables, and its working fine.. but when i have added limit then it gives error
my model funciton is this
$username = trim($this->session->userdata('userdata')['user_username']);
$this->db->select('*');
$this->db->from('sinv');
$this->db->where('sinv.doc_type',"SI");
$this->db->join('customer_agentREL','sinv.custcode = customer_agentREL.custcode');
$this->db->where('customer_agentREL.agent',$username);
$this->db->order_by("sinv.createdate DESC");
$this->db->limit($limit, $start);
$query = $this->db->get();
$result = $query->result_array();
return $result;
eror i am getting is
Error Number: 42000/8156
[Microsoft][ODBC Driver 11 for SQL Server][SQL Server]The column 'custcode' was specified multiple times for 'CI_subquery'.
SELECT * FROM ( SELECT ROW_NUMBER() OVER(ORDER BY "sinv"."createdate" DESC) AS "CI_rownum", * FROM "sinv" JOIN "customer_agentREL" ON "sinv"."custcode" = "customer_agentREL"."custcode" WHERE "sinv"."doc_type" = 'SI' AND "customer_agentREL"."agent" = 'guri' ) "CI_subquery" WHERE "CI_rownum" BETWEEN 31 AND 60
Filename: C:/web/demo2.million-cloud.com/htdocs/system/database/DB_driver.php
Line Number: 691
can anybody help me out