Oracle - query by two column combination
Since you don't care which products are returned

SELECT product, category, market
  FROM (SELECT product, 
               category,
               market,
               row_number() over (partition by market, category
                                      order by rownum) rnk
          FROM product_table
               JOIN availability_table USING (product)
         WHERE num_available &gt; 0)
 WHERE rnk &lt;= 3;