The following is my query and the CASE part is not executing:
$deposit = CurrentTransaction::select('current_transaction.id', 'user.name', 'current_transaction.amount', 'current_transaction.status', 'current_transaction.type', 'current_transaction.refer_id', 'current_transaction.msg', 'current_transaction.remarks', 'current_transaction.created_by', 'current_transaction.created_at')
->join('user', 'current_transaction.user_id', '=', 'user.id')
->where('current_transaction.amount', '>', '0')
->where(function ($query) {
$query->select(DB::raw('CASE WHEN current_transaction.created_by = current_transaction.user_id THEN "true" ELSE "false" END AS "result"'))->where('result', 'false');
})->get();
and the syntax error around where('result', 'false') part.
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire