The following query is giving me time with date but i need only date .How do I do?
$data = DB::table('kahanighar_ivr.kahani_cdr')
->select(DB::raw('count(*) as a'),'dst','calldate as ibdate',DB::raw('"kahani" as ser'))
->where('dst','like','%7787%')
->wheredate('calldate','>=',"$request->start")
->wheredate('calldate','<=',"$request->end")
->groupBy('dst')->groupBy('calldate')
->union(DB::table('kids_ivr.kids_cdr')
->select(DB::raw('count(*) as a'),'dst','calldate as ibdate',DB::raw('"kids" as ser'))
->where('dst','like','%7787%')
->wheredate('calldate','>=',"$request->start")
->wheredate('calldate','<=',"$request->end")
->groupBy('dst')->groupBy('calldate'))
->union(DB::table('news_ivr.news_cdr')
->select(DB::raw('count(*) as a'),'dst','calldate as ibdate',DB::raw('"news" as ser'))
->where('dst','like','%7787%')
->wheredate('calldate','>=',"$request->start")
->wheredate('calldate','<=',"$request->end")
->groupBy('dst')->groupBy('calldate'));
2
Answers
Put
->get()
at the end of the query to get the dataThen use foreach loop to iterate the data
you can use mysql DATE function, it Extract the date part