title: Problems with MariaDB output
body: <p>I'm trying to create a menu based in MariaDB tables.
  We have a associative table, which connects with other tables</p>
  
  <pre><code>#ass_products_categories
  product_id | category_id
  -------------------------
  1          | 1    &lt;- GENDER
  1          | 3    &lt;- AGE
  1          | 16   &lt;- TYPE
  2          | 2
  2          | 3
  2          | 16
  3          | 2
  3          | 4
  3          | 17
  4          | 1
  4          | 2
  4          | 3
  4          | 16
  </code></pre>
  
  <p>The columns references to products table and categories table, obviously</p>
  
  <pre><code>#products
  id | name          | qty | is_published
  ---------------------------------------
  1  | T-Shirt Black | 10  | 1
  2  | Long Dress    | 0   | 1
  3  | T-Shirt Blue  | 10  | 0
  4  | T-Shirt Red   | 10  | 1
  
  #categories
  id | name        | tipology_id
  ------------------------------
  1  | Man         | 1 &lt;- GENDER
  2  | Woman       | 1 
  3  | 3 a 5 years | 2 &lt;- AGE
  4  | 6 a 7 years | 2
  16 | T-Shirt     | 4 &lt;- TYPE
  17 | Dress       | 4
  </code></pre>
  
  <p>This is the output I expect. </p>
  
  <pre><code>[Man]
  ---- [3 A 5 years]
  --------- T-Shirt
  
  [Woman]
  ---- [6 a 7 years]
  --------- T-Shirt
  --------- Dress
  </code></pre>
  
  <p>I can do it with PHP and a lot of loops, but I know is possible to make this with only a good query. But I'm really stuck in a lot of left joins and inner joins.</p>
  
  <p>The point is that: if there's nor a single product published in a category or all products in that category are qty = 0, the category should not appear in menu. The nearest approach I've found was WITH, but it's not possible/available in MariaDB (at least not in the host MariaDB server)</p>
  
  <p>Sorry my bad english, please.
  Thanks for helping.</p>