Use character? in sql queries using codeigniter

5

I have the following SQL query and I want to use the character "?" because the postgres 9.5 syntax requires it, the problem is that codeigniter by default uses that symbol to replace values in the SQL query.

Any recommendations?

SELECT codigo, descr, ( select count(*) from "mi_tabla_2" where coddoc::jsonb ? codigo and coddep = '100' and codserie = '50' and codsubserie = '25' ) as check
FROM "mi_tabla_1" 
WHERE std = TRUE

Thank you.

    
asked by Moises bolaños davila 18.09.2018 в 02:36
source

1 answer

0
$sql = "SELECT * FROM some_table WHERE id = ? AND status = ? AND author = ?";
$this->db->query($sql, array(3, 'live', 'Rick'));

documentation

    
answered by 24.09.2018 в 01:35