Skip to content

Tag: sql

Filtering empty rows from Mysql SELECT query issue

I have a SELECT query as below: This query gives me an output like this: My question is, how to filter the 0 due records from due_balance and modify the query to get the rest? Expecting result should be: I tried it in this way, but it doesn’t work for me. Answer Use HAVING Clause or use subquery then ad…

Recursively Conditionally get parent Id

I have two tables: Budget Line and Expense. They are structured in such a way that an expense must have either a parent record in the budget line table, or a parent record in the expense table. I need to select all child-most expenses for each budget line. For example – BudgetLine: Id Description 1 TEST…