Welcome Guest, Not a member yet? Register   Sign In
problem with database query
#4

[eluser]dagon[/eluser]
It seems that I ran onto another obstacle. Im trying to delete data from two tables using join(). but $this->db->delete() seems to take into consideration only previous declarations of where(), any joins are ommited. The query which I want to perform is:

DELETE TA,TB FROM table_a AS TA LEFT JOIN table_b AS TB ON TA.id = TB.other_id WHERE TA.field = 'value';

I try to solve it like this:

$this->db->from('table_a AS TA');
$this->db->where('TA.field', $value);
$this->db->join('table_b AS TB', 'TA.id = TB.other_id', 'left');
$this->db->delete();

It seems that the above code does not generate the "JOIN" part of the query. Anyone know why ? Maybe this is a bug ?


Messages In This Thread
problem with database query - by El Forum - 07-11-2011, 06:06 AM
problem with database query - by El Forum - 07-11-2011, 11:17 AM
problem with database query - by El Forum - 07-11-2011, 12:55 PM
problem with database query - by El Forum - 07-12-2011, 01:15 AM



Theme © iAndrew 2016 - Forum software by © MyBB