orm icon indicating copy to clipboard operation
orm copied to clipboard

Cannot use multi where in first_where method

Open LordDeveloper opened this issue 2 years ago • 2 comments

Hey, This is my code:

payment = Payment.first_where({
    'transaction_id': req.get('trans_id'),
    'order_id': req.get('order_id')
})

Error: masoniteorm.exceptions.QueryException: (1054, "Unknown column 'payments.{'transaction_id': 'ff9db407-b55c-494b-a8af-a1944cedab0a', 'id': '1'}' in 'where clause'")

LordDeveloper avatar Oct 12 '22 15:10 LordDeveloper

Until solve this, could you try this:

Model.where(field1, value1).where(field2, value2).first()

?

Marlysson avatar Oct 12 '22 16:10 Marlysson

Referenc

Hi, Yes this is working correctly.

LordDeveloper avatar Oct 12 '22 20:10 LordDeveloper