Support the ongoing development of Laravel.io →
Database Eloquent
Last updated 2 years ago.
0

Can you post your code? Can't really see how you are building the query or what you are trying to accomplish. You don't need the DB::. Try just ->raw. Or you can use the standard ->select('blurb') and use your as in there.

Why does each table need an alias? Old db? Can you not just rename your tables? Or are you trying to make it work better with your Models?

You will probably be better off in this case using raw on its own and not trying to chain with Eloquent.

DB::table('table')->raw('full query here')->get()

It will be a little more expressive and easier to understand in the future.

Last updated 2 years ago.
0

This is the solution

$results = DB::select('select * COMPLICATED QUERY = ?');

http://laravel.io/forum/02-27-2014-how-would-one-run-a-select-on-a-subquery-using-fluent?page=1

Thank you T2theC.

Last updated 2 years ago.
0

Sign in to participate in this thread!

Eventy

Your banner here too?

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

Laravel.io

The Laravel portal for problem solving, knowledge sharing and community building.

© 2024 Laravel.io - All rights reserved.