How can I compare a subquery with a column in Laravel's query builder? whereColumn
method only accepts string values for columns, where
method on the other hand is not suitable, as it compares a column or a subquery against a specific value.
1 Answer
Why isn't the where method suitable? You can do
DB::query()
->from('a_table')
->where('column_a', '=', function ($query) {
$query->select('column_b')->from('some_other_table')->limit(1);
});