I have a query
SELECT l.id,l.name,l.city,l.email,l.phone,l.status,l.source,l.leadCreatedTime,l.organizationId
FROM (
SELECT id
FROM leads
where removed='0'
ORDER BY
id
LIMIT 40000
) o
JOIN leads l
ON l.id = o.id
ORDER BY
l.id
I want to convert this query in Codeigniter format for eg
$this->db->select('l.id,l.name,l.city,l.email,l.phone,l.status,l.source,l.leadCreatedTime,l.organizationId');
$this->db->from('leads');
Im having problem in the 8th line of query where the fetched data is defined as o how am I suppose to write that in CI