All Questions
2 questions
2
votes
2
answers
224
views
Select random database records between subset of records having the same count(*) in a query
I have this simple query:
SELECT `value`, count(*) as `noHits`
FROM `topic`
WHERE identifier IN ('" . implode("','", array_keys($processedIdentifier)) ."')
GROUP BY `value`
...
1
vote
2
answers
4k
views
How to select random row with count()
Table names:
g_number name
123 John
123 Sara
123 Michael
I want to get one RANDOM name and quantity of all names with the same g_number in one query:
SELECT name, count(*) cnt
...