I need a way to select for example every tenth row. Let us say that I have 100 rows. I want to get row 1, 11, 21, 31, 41 and so on as the result. Can someone please help me? I am using PHP SDK and NIQL. I can do it in MySQL but it seems that I can’t use that query in Couchbase. This is the MySQL query.
$result = mysql_query(“SELECT product_id, name FROM (SELECT @row := @row +1 AS rownum, name FROM (SELECT @row :=0) r, product WHERE id = ‘$id’ ORDER BY sort ASC) ranked WHERE rownum % $factor = 1”);