XF 2.1 Compare 2 column in finder->where()

abdfahim

Well-known member
Can a finder object comapres values of 2 columns? I tried the following, but the result was inconsistent
$finder->where('col_1', '=', 'col_2')

Basically, I am trying to replicate the following SQL query

WHERE col_1 = col_2
 
right.. try:

PHP:
$finder->whereSql(
    '%s = %s',
    $finder->columnSqlName('col_1'),
    $finder->columnSqlName('col_2')
);
 
Back
Top Bottom