0

What is laravel eloquent equivalent to this query:

SELECT product_sku, request_id, product_id,

GROUP_CONCAT(case when ai_result = 'Match' then concat(r_image_url, '&id=', hash_id) END) as matched,
GROUP_CONCAT(CASE when ai_result = 'Non Match' then concat(r_image_url, '&id=', hash_id) END) as non_matched

FROM `product_match_unmatches` 
WHERE (request_id, product_id) NOT IN ((66,0),(66,1),(66,19),(66,22),(66,35),(66,30))
GROUP BY request_id, product_id

I have this working query upto where not in.

$products = DB::table('product_match_unmatches')
        ->select('product_sku', 'request_id', 'product_id')
        ->selectRaw('group_concat(case when ai_result = "Match" then concat(r_image_url,"&_id=",hash_id) END) as matched,
            group_concat(case when ai_result = "Non Match" then concat(r_image_url,"&_id=",hash_id) END) as non_matched,
            group_concat(s_image_url) as s_images');

But I am stuck on where not in part.

Azima
  • 3,835
  • 15
  • 49
  • 95

0 Answers0