Question: I want to do a sql query like

```
select * where x = 10 and (y=12 or h=15)

```

How can I achieve that in CI ActiveRecord format?

Answer: 
See [Active record](http://ellislab.com/codeigniter/user-guide/database/active_record.html#select) reference 

```
$where="x = 10 and (y=12 or h=15)";
$this->db->select('*');
$this->db->from('mytable');
$this->db->where($where);
$query = $this->db->get();

```
Try like

```
$sql = "SELECT * FROM TABLE_NAME WHERE x = 10 AND (y = 12 OR h = 15)";
$result = $this->db->query($sql);

```

Or like

```
$this->db->select('*');
$this->db->from('TABLE_NAME');
$this->db->where('x',10);
$this->db->AND('y',12);
$this->db->or_where('h',15);
$query = $this->db->get();

```