Could someone take a look at this fiddle: http://sqlfiddle.com/#!9/1c2a3b/1
I’m trying to get a dynamic number of rows depending on a product’s quantity. For example, if I have a quantity of 3 apples in my database, the SQL query should find out if there are 3 or more rows and give a specific result if there are, and a different result if there aren’t.
Can you figure out where the problem is?
If my question is not clear, please let me know where I can elaborate. The current result in the fiddle gives me 2 rows even though there are clearly 3 rows in the database (for product_id #1).
Thank you for stopping by