如何在加入时DATE 2列

When i join my 2 tables with same day but different time, i need to use DATE() to get only day. So my query like this:

$this->db->join('expense_invoice', 'DATE(expense_invoice.date) = DATE(revenue_invoice.date)');

But codeigniter got me wrong and this result like this

ON `DATE`(`expense_invoice`.`date))` = DATE(revenue_invoice.date) 

So how can date() those 2 columns when joining them? thank you.

The fact that you try to join like that suggests you have something wrong with your design. I know it doesn't answer your direct question, I could give you quick copy/past answer to parse dates but it would lead you nowhere in medium term. Can you think about relationships between expense_invoice and revenue_invoice? Can you link them using foreign keys? If so then you should first join them and then implement a filter by date only on one of the domain objects. Otherwise you risk joining data realted to different orders/clients etc - just to happen to happen in the same day.

PS: would ask a question in a comment if I could ;)