Skip to content
Advertisement

Tag: select

Combining MySQL Queries to get total amount

I’m trying to combine the following 2 queries. table_A stores a list of available appointments and number_open is how many open slots there are for a specific appointment, in this case 2020-06-30 AM which has 5 open. table_B contains any dates waiting to be accepted and has a different record for each date request, so in this case, 2 rows

CTE Recursive Query to Grandparents

I have following table: What I need to get is SELECT query that will return only rows that have ISDELETED 0 and ISINEDIT 0 and whose parents or grandparents are 0 as well I currently have: But for some reason it returns double rows Answer You need to add the same isdeleted = 0 AND isinedit = 0 predicate to

MySQL Debit/Credit cumulative balance

I would like a cumulative DR or CR balance for the following table: For the above table, a cumulative Balance column would be: Decreasing a DR below 0 makes it a CR Decreasing a CR below 0 makes it a DR Where balance is 0, value is 0 DR It could be calculated as CR’s being a negative value, but

Advertisement