'Laravel Postgresql - join query on jsonb column with existence operator - "?"

I want to execute the below query in laravel 9.x and postgresql 14

select * from "tbl_1" inner join "tbl_2" on "tbl_1"."m_ids" ? "tbl_2"."t_id"::text

m_ids is a jsonb column where value is stored like this: ["1", "2", "3"]

Any help would be appreciated. Thanks.

I tried to execute with DB::select() and

join('tbl_1', 'tbl_1.m_ids', DB::raw('?'), DB::raw('tbl_2.t_id::text'))

but no luck.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source