Reputation: 13
I have 3 tables in my database :
reponse[id,nomRep,#envoi_id]
envoi[id,#projet_id,#quest_id]
projet[id,nomProjet]
What i want to do is to get the name of my project using the code below:
$days = Input::get('days', 7);
$range = \Carbon\Carbon::now()->subDays($days);
$chartt = DB::table('reponse')
->where('created_at', '>=', $range)
->groupBy('value')
->remember(1440)
->get([
DB::raw('envoi_id as nomProjet')// here where i want to get the name of my project,
DB::raw('etatSatisfaction as value')
]);
return $chartt;
Any help please?
Upvotes: 0
Views: 150
Reputation: 13
here is the answer i found it by my self, mybe someone need it:
DB::raw(' (SELECT p.nom FROM projet p,ligneenvoi l WHERE rep.ligneenvoi_id=l.id AND l.projet_id=p.id) AS nomProjet ') ,
Upvotes: 1