dimanche 4 octobre 2020

How to add single quote instead of double quote with raw query laravel?

Below is my query;

select "column1", "desc", if r_id = P then Y else 
'N' endif As is_selected from "other" where 
"rtype" = D_STATUS

Below is my query builder function,

DB::table('other')
->select('r_id', 'description', DB::raw("if r_id ='P' then 'Y' else 'N' endif As is_selected")) //Error
->where('rtype', '=',  $strType )
->get();

Here I got error ;

Column "Y" not found.

I want to add single quote instead of double quote in all static string values in query. How can I do that?



from Newest questions tagged laravel-5 - Stack Overflow https://ift.tt/33upn4R
via IFTTT

Aucun commentaire:

Enregistrer un commentaire