You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Initially my SQL query is as follows: $survey_answers = DB::Select(DB::raw(" SELECT survey_id, trigger_survey_id, cast((arr.response->>'q_id') as integer)as question_id, cast(((arr.response->'answer')->>'score') as decimal) as score, trim(lower(email)) as email FROM survey_answers, jsonb_array_elements(response) with ordinality arr(response,position) where submission='complete' and survey_id=2 and trigger_survey_id=4 and ((arr.response->'answer')->>'score') is not null group by 5,1,2,3,4 "));
But the output after conversion I got is as follows : DB::table("survey_answers, jsonb_array_elements where_subquery_group_4_ with ordinality arr where_subquery_group_5_") ->select("survey_id", "trigger_survey_id", "cast ((arr.response->>'q_id') as integer) as question_id", "cast (((arr.response->'answer')->>'score') as decimal) as score", "trim (lower(email)) as email") ->where("submission", "=", complete) ->where("survey_id", "=", 2) ->where("trigger_survey_id", "=", 4) ->groupBy("5") ->get();
Please help me with retrieving the jsonb columns wise data extraction into Laravel Eloquent
Thanks In Advance!
The text was updated successfully, but these errors were encountered:
The text was updated successfully, but these errors were encountered: