CodeIgniter Join with Multiple where clause

Viewed 28

I am new to PHP, I am using this query to get the number of floors in inventory, and it's working fine :

$data['Floors'] = $this->db
    ->get_where('tblcustomfieldsvalues', ['fieldid' => 75, 'fieldto' => 'inventory', 'value' => 'Floor'])
    ->num_rows();

And I am using this query to get the number of exclusive inventories, and its also working fine:

$data['total_leads_exc'] = $this->db
    ->from('tblinventory_status')
    ->where('id',10)
    ->get()
    ->num_rows();

Now I want to get the number of exclusive floors in inventory, where I think I need to join both queries so I am using the Join query like this:

SELECT tblnleads.name FROM tblnleads 
    LEFT JOIN tblcustomfieldsvalues
        ON tblcustomfieldsvalues.id = tblnleads.id
    WHERE tblnleads.status = '10'
        AND tblcustomfieldsvalues.fieldid = '61'
        AND tblcustomfieldsvalues.fieldto = 'inventory'
        AND tblcustomfieldsvalues.value = 'Floors';

But I am not getting the results.

0 Answers
Related