The following query is working fine in phpmyadmin (sql)
select id ,fname , last_order_date , created_at, 'masterdealers' as Source, null as type, (select id as uuid from uuids WHERE userable_type LIKE '____m%' AND userable_id = masterdealers.id) as uuid FROM masterdealers UNION ALL select id ,fname,last_order_date , created_at, 'dealers' as Source , null as type,(select id as uuid from uuids WHERE userable_type LIKE '____d%' AND userable_id = dealers.id) as uuid FROM dealers UNION ALL select id,fname,last_order_date , created_at, 'customers' as Source , type , (select id as uuid from uuids WHERE userable_type LIKE '____c%' AND userable_id = customers.id) as uuid FROM customers where created_at >= '".$startDate."' AND created_at <= '".$endDate. "'
But when i use this query in laravel controller as follow, it returns empty string
$results = DB::select("select id ,fname , last_order_date , created_at, 'masterdealers' as Source, null as type, (select id as uuid from uuids WHERE userable_type LIKE '____m%' AND userable_id = masterdealers.id) as uuid FROM masterdealers UNION ALL select id ,fname,last_order_date , created_at, 'dealers' as Source , null as type,(select id as uuid from uuids WHERE userable_type LIKE '____d%' AND userable_id = dealers.id) as uuid FROM dealers UNION ALL select id,fname,last_order_date , created_at, 'customers' as Source , type , (select id as uuid from uuids WHERE userable_type LIKE '____c%' AND userable_id = customers.id) as uuid FROM customers where created_at >= '".$startDate."' AND created_at <= '".$endDate. "'");
dd($results);