如何使用MYSQL MARIADB在两列中搜索,如果column1中的key1等于value1并且key2等于column2中的value2?

时间:2018-11-22 17:33:05

标签: mysql json laravel mariadb

一栏有效

whereJsonContains('VehicleApplications'
        ,['ModelName' => $model, 'YearID' => $year] )->paginate(10);

1 个答案:

答案 0 :(得分:0)

如果有人知道更干净的查询,请确保定义变量类型

    $make       = (string) $make;
    $model      = (string) $model;
    $year       = (int) $year;
    $category   = (int) $category;

    whereJsonContains('VehicleApplications',
        ['ModelName' => $model, 'YearID' => $year]
    )->
    whereJsonContains('pcItems',
        ['pcCategoryID' => $category]
    )->paginate(10);