这是我在MySQL 中的查询
select *
from une_uninegocio_mstr, ban_bancos_mstr, cue_cuentas_mstr, cued_cuentas_det
left join tra_traspasos_mstr on tra_cue_orig_id = cued_id and tra_fecha = cued_fecha
where cue_cuentas_mstr.cue_id = cued_cuentas_det.cued_id
and cue_cuentas_mstr.cue_uninegocio_id = une_uninegocio_mstr.une_id
and ban_bancos_mstr.ban_id = cue_cuentas_mstr.cue_banco_id
and une_uninegocio_mstr.une_id = "1"
and cued_fecha = curdate();
codeigniter能做什么?
您可以在联接中使用AND
。
在代码点火器中,它是这样的,
$this->db->join('tra_traspasos_mstr', 'tra_cue_orig_id = cued_id and tra_fecha = cued_fecha');
但我建议您在联接中使用tablename.columnname
。