abdfahim Well-known member Mar 20, 2019 #1 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
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
abdfahim Well-known member Mar 21, 2019 #3 nocte said: try $finder->columnSqlName('col_2') Click to expand... This translates into WHERE `table_name`.`col_1` = '`table_name`.`col_1`'. So, not working as expected.
nocte said: try $finder->columnSqlName('col_2') Click to expand... This translates into WHERE `table_name`.`col_1` = '`table_name`.`col_1`'. So, not working as expected.
nocte Well-known member Mar 21, 2019 #4 right.. try: PHP: $finder->whereSql( '%s = %s', $finder->columnSqlName('col_1'), $finder->columnSqlName('col_2') );
right.. try: PHP: $finder->whereSql( '%s = %s', $finder->columnSqlName('col_1'), $finder->columnSqlName('col_2') );