V
V
Veronika Stepanovna2016-10-09 10:56:20
MySQL
Veronika Stepanovna, 2016-10-09 10:56:20

Why is the query returning only one field?

Have a request

select c.*, count(p.id) as posts 
from categories as c 
left join post as p 
on c.id = p.category 
where p.category = c.menu_id

It returns the correct result, but only one field, and there should be two. What could be the problem?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
SimBioT19, 2016-10-09
@sargss

It is difficult to understand when there is no database structure. Try to stick it inGRUOP BY

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question