DB or Eloquent

Published 4 months ago by amjadkhan896

Hi any body here to help me and convert this

SELECT * FROM company_profiles LEFT JOIN ( SELECT COUNT(jobs_posted.id ) AS jobsCount, jobs_posted.customer_id FROM jobs_posted GROUP BY jobs_posted.customer_id ) as t on t.customer_id = company_profiles.customer_id ORDER BY jobsCount desc

in to laravel Query Builder or Eloquent I tried my best but i can't figured it out Thanks

Best Answer (As Selected By amjadkhan896)
yamin27

Your Query is wrong. Correct the query and try this: http://www.midnightcowboycoder.com/

bobbybouwmann

What have you tried so far? Have you tried using a raw query for this?

Documentation: https://laravel.com/docs/5.6/queries#raw-expressions

yamin27

Your Query is wrong. Correct the query and try this: http://www.midnightcowboycoder.com/

amjadkhan896

@yamin27 tried and it says invalid query. But i made and it gives me the correct result

amjadkhan896

Thanks @yamin27 @bobbybouwmann it works.

Please sign in or create an account to participate in this conversation.