Welcome Guest, Not a member yet? Register   Sign In
WHERE `column` = `column`
#1

[eluser]skunkbad[/eluser]
I'm using active record, and need to query

WHERE `column_a` = `column_b`

but

$this->db->where() doesn't work. Do I have to create a custom query?
#2

[eluser]Jamie Rumbelow[/eluser]
You can pass a single string to $this->db->where() and it'll work fine. So:

Code:
$this->db->where('column_a = column_b');

Jamie
#3

[eluser]skunkbad[/eluser]
[quote author="Jamie Rumbelow" date="1273114538"]You can pass a single string to $this->db->where() and it'll work fine. So:

Code:
$this->db->where('column_a = column_b');

Jamie[/quote]

Well, I had to use backticks to make it work. Thanks

Code:
$where = 'product_id = `product_group`';
$this->db->where($where);




Theme © iAndrew 2016 - Forum software by © MyBB