lundi 8 juin 2020

union of 3 query in laravel

I have 3 table and want to get the data in laravel.Below is my sql query and fetched data properly but in laravel DB::select() received as json object "types":[{"lead_stage":"PGL"},{"lead_stage":"first_time"},{"lead_stage":"SAL"},{"lead_stage":"BGL"},{"lead_stage":"Identified"},{"lead_stage":"follow_up"},{"lead_stage":"QO_to be approved"}], I want to get lead_stage

    $filter_teams_string =  "'" . implode("', '", $filter_teams) . "'"; 
$filter_username_string =  "'" . implode("', '", $filter_username) . "'";
$geo_string =  "'" . implode("', '", $geo) . "'"; 

$filter_type_details=DB::select("select lead_master.lead_stage from lead_master inner 
join  user_master on user_master.user_name=lead_master.assigned_user_name where region in (".$geo_string.") and teams in (".$filter_teams_string.") group by (lead_stage) 
union
select  meeting_hash from meetings_master where assigned_user_name in (".$filter_username_string.") and meeting_hash in ('follow_up','first_time') group by (meeting_hash) 
union
select sales_stage from opportunity_master where sales_stage in ('Identified','QO_to be approved') and assigned_user in (".$filter_username_string.") group by (sales_stage)");


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

Aucun commentaire:

Enregistrer un commentaire