Skip to content
Advertisement

Cannot union two Joints Laravel

Im trying to union 2 joins, but im getting weird error…

I have “Clientes” -> means clients, and i got all the clients that they got registered in orders and news.

In news table i got the cliente_id -> client_id , And in orders, i got the same, cliente_id -> client_id,

In news i got x clients, and in orders i got Y clients, they are 99% diferent usually,

I want to get all those clients in orders and in news.

So i did a MYSQL query that it works…

JavaScript

The problem is that in LAralvel o query builder it doesnt not work.

JavaScript

I got this error… BadMethodCallException Method IlluminateDatabaseEloquentCollection::getBindings does not exist.

Advertisement

Answer

remove get() from first query

JavaScript

Ref:https://laravel.com/docs/8.x/queries#unions

User contributions licensed under: CC BY-SA
5 People found this is helpful
Advertisement