Kirankumar Dafda
Kirankumar Dafda

Reputation: 2384

Replace double quote with single quote using laravel select query

I am using laravel to get data from my database where i required to get the instruction with single quote Means wants to replace double quote with single quote wherever the double quote is used. I am new to laravel, i know query structure of MySql and understanding laravel so any suggestion will be helpful for me.

Edited

An example of MySql Query is as below, I wants something like this in laravel

select replace(col_instruction,'"',"'") from mytable

Upvotes: 2

Views: 2742

Answers (1)

Alexey Mezenin
Alexey Mezenin

Reputation: 163768

According to the documentation, this should work:

$result = DB::table('mytable')->select(DB::raw('replace(col_instruction, \'"\',"\'")'))->get();

Upvotes: 4

Related Questions