How can I convert below mysql query to laravel query builder -


select sql_calc_found_rows * ( (select 1 orderfield, mem.fname, mem.lname, mem.profilenam, mem.mem_id, mem.photo, mem.ethnicity, mem.profile_type, mem.gender, mem.verified, mem.deleted members mem inner join network net on net.frd_id = mem.mem_id net.mem_id= '1728' , (mem.profilenam '%abc%' or lname 'abc%' or concat(fname, ' ', lname) 'abc%') ) union (select 2 orderfield, fname, lname, profilenam, mem_id, photo, ethnicity, profile_type, gender, verified, deleted members (profilenam '%abc%' or lname 'abc%' or concat(fname, ' ', lname) 'abc%') ) ) t t.verified='y' , t.mem_id not in (1,2,3,4,5,1728) , t.deleted='n' group t.mem_id order t.orderfield,t.profilenam desc 0,50

db::statement("select sql_calc_found_rows * ( (select 1 orderfield, mem.fname, mem.lname, mem.profilenam, mem.mem_id, mem.photo, mem.ethnicity, mem.profile_type, mem.gender, mem.verified, mem.deleted members mem inner join network net on net.frd_id = mem.mem_id net.mem_id= '1728' , (mem.profilenam '%abc%' or lname 'abc%' or concat(fname, ' ', lname) 'abc%') ) union (select 2 orderfield,  fname,  lname,  profilenam,  mem_id,  photo, ethnicity,  profile_type,  gender,  verified,  deleted members (profilenam '%abc%' or lname 'abc%' or concat(fname, ' ', lname) 'abc%') ) ) t t.verified='y' , t.mem_id not in (1,2,3,4,5,1728) , t.deleted='n' group t.mem_id order t.orderfield,t.profilenam desc 0,50"); 

Comments

Popular posts from this blog

javascript - jQuery: Add class depending on URL in the best way -

caching - How to check if a url path exists in the service worker cache -

Redirect to a HTTPS version using .htaccess -