SELECT * FROM (SELECT ROW_NUMBER() OVER(ORDER BY ltrim(rtrim(products.artist))) AS n, products.artist, MAX(products.permalink) AS permalink, MAX(image) AS artistImage FROM products WHERE products.inactive<>1 AND products.artist like 'q%' and permalink<>'' and permalink is not null GROUP BY products.artist) AS a WHERE a.n BETWEEN (0) AND (20)