Query with the following logic

Asked

Viewed 406 times

0

Hello friends of the community. I need to fill a chart but I can’t assemble the query to receive the attributes, could someone help me? The query I need to do is the following.

select client.name, count(*) as Tickets 
from client, ticket 
where client.id = ticket.client_id 
group by client.id

1 answer

1


Can you try:

use DB;
...
$dados = DB::select('select client.name, count(*) as Tickets 
from client, ticket 
where client.id = ticket.client_id 
group by client.id');
  • It worked fine, thanks friend :)

  • You’re welcome @Felipepaetzold, thank goodness

Browser other questions tagged

You are not signed in. Login or sign up in order to post.