How do I select only the first 10 results of a query?
I would like to display only the first 10 results from the following query:
SELECT a.names,
COUNT(b.post_title) AS num
FROM wp_celebnames a
JOIN wp_posts b ON INSTR(b.post_title, a.names) > 0
WHERE b.post_date > DATE_SUB(CURDATE(), INTERVAL 1 DAY)
GROUP BY a.names
ORDER BY num DESC
In SQL Server, use:
select top 10 ...
e.g.
select top 10 * from myTable
select top 10 colA, colB from myTable
In MySQL, use:
select ... order by num desc limit 10