I want to get the number of selected rows as well as the selected data. At the present I have to use two sql statements:
one is
select * from XXX w
To get the number of unique titles, you need to pass the DISTINCT clause to the COUNT function as the following statement:
SELECT COUNT(DISTINCT column_name) FROM 'table_name';
Source: http://www.sqlitetutorial.net/sqlite-count-function/