writting raw query in codeigniter code example
Example 1: codeigniter raw query
$sql="Select * from my_table where 1";
$query = $this->db->query($SQL);
return $query->result_array();
Example 2: raw query in codeigniter
$query = $db->query('YOUR QUERY HERE');