Welcome Guest, Not a member yet? Register   Sign In
Query builder subquery added multiple quotes if select more than 1 column
#2

@nata,

I don't understand your question. Are you receiving errors? Are you asking if what you have above is correct?

Here are some possible solutions:
- https://stackoverflow.com/questions/4610...n-subquery
- Query Binding ( https://www.codeigniter.com/user_guide/d...y-bindings ). This will allow you to do the following...

$sql = "SELECT pendaftaran_id, pendaftaran_tanggal
FROM (SELECT trx_no, pendaftaran_id FROM t_transaksi GROUP BY trx_no, pendaftaran_id) as t_trx
JOIN t_pendaftaran ON t_pendaftaran.pendaftaran_id = t_trx.pendaftaran_id";
$this->db->query($sql);
- Or you could create a database view (with the generated query in the database) and then call the view in CI.
Reply


Messages In This Thread
RE: Query builder subquery added multiple quotes if select more than 1 column - by php_rocs - 06-13-2019, 09:01 AM



Theme © iAndrew 2016 - Forum software by © MyBB