Skip to content

Tag: having-clause

Return only recipes that contains all ingredients Sql

I have these 3 tables: Drinks drink_id name Ingredients ingredient_id name Opskrifter drink_id ingredient_id quantity Drinks and Ingredients are cross-referenced in opskrifter. I want to return all recipes from opskrifter that have ingredients from another table called Stock name So to make a gin and tonic, I need to have both gin and tonic in stock. If I only have

Remove zero amount in a query

I have a table finalData with the following columns and data I am creating mysql query to display the income and expenses of Singapore per Area, but I have to exclude areas that has zero amount. Here’s the code I tried: Output should be like this Any help would be appreciated. Thanks Answer This logic would be simpler phrased with