Support the ongoing development of Laravel.io →
posted 6 years ago
Last updated 2 years ago.
0

$data = DB::table('kititens')->select('kititens.qtde','kititens.base',DB::row("(SELECT descricao FROM produtos WHERE kititens.kit = produtos.id) AS kit"),DB::row("(SELECT descricao FROM produtos WHERE kititens.produto = produtos.id) AS item"))->get();

0

Thank you, I'll take the test. I managed to sort this out, but I'll compare to see the difference.. I created the query so.

$query = DB::table('kititens')->where('deleted_at', '=', NULL) ->select('kititens.*', (DB::raw("(SELECT descricao FROM produtos u1 WHERE u1.id = kititens.produto ) AS kit ")), (DB::raw("(SELECT descricao FROM produtos u1 WHERE u1.id = kititens.kit ) AS item"))) ->get();

Will I have any future problems?

Thank you for the help.

0

Sign in to participate in this thread!

Eventy

Your banner here too?

Edilson edilson Joined 12 Oct 2018

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.

© 2025 Laravel.io - All rights reserved.