i have two tables:
table1: id, user_id, poll_id, options_id
table2: id, poll_id, votes
column votes is an integer and i want to change the value by joining the tables with some where clauses:
$this->db
->set('votes', 'votes - 1', FALSE)
->join('table1', 'poll_votes.options_id = table2.id')
->where('poll_id', $row)
->where('user_id', $id)
->update('table2');
I´m getting this error:
Error Number: 1054 Unknown column 'user_id' in 'where clause' UPDATE `table2` SET votes = votes - 1 WHERE `poll_id` = '9' AND `user_id` = '1'
echo $this->db->last_query();And maybe post it here as well - DeiForm