mercredi 29 mai 2019

Laravel responce returns empty but when I print and ran the query in db it works

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();



from Newest questions tagged laravel-5 - Stack Overflow http://bit.ly/2HIvbwX
via IFTTT

Aucun commentaire:

Enregistrer un commentaire