i have this query in CI Active record Form

```
$this->db->select('companies.*,comp_permissions.user_id');
$this->db->from('companies');
$this->db->join('comp_permissions', 'companies.id = comp_permissions.comp_id');
$query = $this->db->get();

```

it generates query like this

```
SELECT `hs_companies`.*, `hs_comp_permissions`.`user_id`
FROM (`hs_companies`)
INNER JOIN `hs_comp_permissions` ON `hs_companies`.`id` = `hs_comp_permissions`.`comp_id`

```

But My Original query is 

```
Select cb.*,cbp.user_id
from hs_companies cb
INNER JOIN hs_comp_permissions cbp ON 
(cb.id = cbp.comp_id AND cbp.status=2 AND cbp.user_id = 72)

```

so now how do i put multiple columns in JOIN function?

**UPDATE**

when i tried like this 

```
$this->db->select('companies.*,comp_permissions.user_id');
$this->db->from('companies');
$this->db->join('comp_permissions', '(companieas.id = comp_permissions.comp_id AND comp_permissions.status = 2 AND comp_permissions.user_id = 72)','inner');
$this->db->get()->result();

```

It generate following result

```
SELECT `hs_companies`.*, `hs_comp_permissions`.`user_id` 
FROM (`hs_companies`) 
INNER JOIN `hs_comp_permissions` ON 
(`hs_companies`.`id` = `hs_comp_permissions`.`comp_id` AND comp_permissions.status = 2 AND comp_permissions.user_id = 72)

```

it doesnot add `hs_` my db prefix