Bhuvnesh Pratap Bhuvnesh Pratap - 2 months ago 9
MySQL Question

Search value in multiple column according to below query using laravel query builder?

Please let me clear about the syntax.My question is that ,How to write the below query

Laravel 4.2
query builder?

SELECT * FROM table WHERE 123 IN (col1, col2, col3, col4);


How to write query in Laravel 4.2? In that i have to search
string
in multiple column.

Answer

Try this

DB::table('table')->whereRaw('123 in (col1, col2, col3, col4));

OR

If you made model for the tabel

table::whereRaw('123 in (col1, col2, col3, col4));
Comments