Welcome Guest, Not a member yet? Register   Sign In
BUG SELECT_MAX
#1

[eluser]jgodino[/eluser]
I’m trying to create a SQL query using active record. But the SQL query being created is wrong.

Code:
...
$this->db->select_max('act_secuencia');        
    $this->db->from('actas');
    $this->db->where('act_entidad_id', $registro_actual->act_entidad_id);
    $this->db->where('act_numero', $registro_actual->act_numero);
    
        return $this->db->get()->row();    
...
This outputs with the following error:

Error Number: 1064

Code:
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '`)` AS act_secuencia FROM (`sec_actas`) WHERE `act_entidad_id` = '6' AND `act' at line 1

SELECT `MAX(`act_secuencia`)` AS act_secuencia FROM (`sec_actas`) WHERE `act_entidad_id` = '6' AND `act_numero` = '1'

There is ' before MAX.

I have the last version.

Thanks

Javier




Theme © iAndrew 2016 - Forum software by © MyBB