You want retrieve 10 results at a time, but at the same time you want to display total rows count?

SELECT SQL_CALC_FOUND_ROWS column_name FROM table_name LIMIT 1,10; SELECT FOUND_ROWS();

The second query (COUNT() is never used) will tell you how many results there are total, so you can display a phrase “Found 20000 results, displaying 1-10”. Note that FOUND_ROWS does not pay attention to the LIMITs you specified and always returns the total number of rows affected by query.

how do you find out the unique values?

Using DISTINCT in the query, such as SELECT DISTINCT column_name FROM table_name; You can also ask for a number of distinct values by SELECT COUNT (DISTINCT column_name) FROM table_name;