B
B
bismoney2015-11-26 18:26:46
MySQL
bismoney, 2015-11-26 18:26:46

How to count the number of elements?

Hi friends!
I can't figure out how to calculate.
It is necessary to make a selection from the test table sorted by date and with a limit of 10 records
And then from these 10 records count how many of them in the ff_id field is equal to 2
How will such a query look correctly?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
P
PrAw, 2015-11-26
@bismoney

SELECT COUNT(*) FROM (
   SELECT ff_id FROM test ORDER BY date_added LIMIT 10 
) test_outer
WHERE ff_id=2

именование результирующей таблицы обязательно.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question