consider using sub queries
Mar 9, 2020
6
Level 1
Question mark in raw sql query cause problem
Hi. I have a problem in my raw query select. Example query:
DB::select( DB::raw(
"SELECT * FROM event e WHERE e.repeat_every->'daysInWeekRepeat' ? :dayNow"
),
['dayNow' => 'mon' ]
);
(Original query is much more complicate this is only example.)
Column "repeat_every" is a jsonb column, and I have to use question mark to search param value in array. This question mark cause a problem "invalid paremeter number". In output insted of question mark I get first param passed to query.
SO how to write this query to ignore question mark as a placeholder?
Thank you.
Please or to participate in this conversation.