I need to get only 1 record from a SQL query result.
We use "SELECT TOP 1" in standard SQL, but how can we do that in CodeIgniter? Is there any function for that?
with LIMIT
$this->db->limit(1);
$query = $this->db->get('my_table');
$myRow = $query->row();
with OFFSET and LIMIT
$query = $this->db->get('mytable', 0, 1);
$myRow = $query->row();