0

I am trying to build a query in Kohana and struggling to convert the query given to me by a DB admin into kohana query builder syntax. The query is failing when trying to compare the following:

AND du.user_key = dd.user_key

Using the syntax

->and_where('du.user_key', '=', 'dd.user_key')

I know this is because the builder is expecting the params, column, op, value. SO my question is there away to get the builder to recognise the value as a DB column, i have been looking through the docs but but to no avail... Any help would be appreciated.

CHeers

Opentuned
  • 1,477
  • 17
  • 21

1 Answers1

1

You can use the DB::expression

http://kohanaframework.org/3.0/guide/database/query/builder#database-expressions

So in the case of this example:

->where('du.user_key', '=' ,DB::expr('dd.user_key'))
Opentuned
  • 1,477
  • 17
  • 21