This is the query code that I am using please look and help me out. I would really appreciate it
DB::table('position as p')->addSelect(\DB::raw(
'p.*,(SELECT name from user where user.id=p.user_id) as name'
))->addSelect(\DB::raw(
'DATE_FORMAT(p.created_at,"%H:%i") as time'
))
->whereRaw($wr)
->whereRaw(
"(p.id =(SELECT id FROM position WHERE position.user_id=p.user_id AND Date(position.created_at)='".$date."' order by position.id asc limit 0,1) Or p.id =(SELECT id FROM position WHERE position.user_id=p.user_id AND Date(position.created_at)='".$date."' order by position.id desc limit 0,1))"
)
->orderBy("p.user_id","asc")->orderBy("p.id",'asc')->get();
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire