The first query does not run because I have a SUM() inside a LAG() which is just illegal but I’ve included it just to conceptualize the idea. Or Now I should mention there is are two null columns, result and CumRes, in “ready_set” which is why the second query even runs. Here is the exact idea shown in an Excel
Tag: recursion
Calculate the time taken by a recursive function each time it is called… in SQL
I have the data like below id | Function_name | event | time 1 function_a start 12:01 2 function_a start 12:02 3 function_a start 12:03 4 function_a end 12:04 …
SQL server: Question about query group and auto id
i have a table which has 2 columns like this, picture is input and output: Explain input: 2 column is 2 person who relation ship together. Exam: A relation with B, C,D,H Output: i want to merge 2 column , with Column group ID auto and column RelationShip ID group auto: i tried query: row_number() OVER (ORDER BY [columnA]) n
Creating a recursive query in SQL
I have data like this: Person A has a relationship with Person B, and person A has a relationship with Person C Person B has a relationship with D and E. I want to view result in group in SQL Server (A, B ,C,…) and (B,D,E,…) I have tried looking recursive but not getting this to implement. I need to
SQL Recursive Count
I have two tables I am joining with the following structure: A ContentDivider can have n ContentDividers as Children and can have m CustomPages as children as well. I want a View that counts the Display the current CustomDivider and the COunt for all the CustomPages as Children of the current ContentDivider. My Test data: And the View I want
Recursive query design – Oracle SQL
I am looking to create a recursive query that is able to completely map a series of replenishments, to a top level requirement. Below is some detailed information regarding my problem statement: I …
detect cycles in a graph in SQL using recursive common table expression
Given a directed graph having a cycle, how do you detect and list the cycle using only standard SQL ? input = graph edges and a root node from which we compute the transitive closure. Output = …
Use SQL Server recursive common table expression to get full path of all files in a folder(with subfolders)
There is a SQL Server undocumented extended stored procedure called xp_dirtree, which can return all files and folders name (include subfolders) in a table format. To practice my understanding of …
How to store ordered items which often change position in DB
I need to be able to store a large list of ordered items in the DB. So far that’s straight-forward: In queries, I always need to get just a few items (filtered based on OtherFields) but in the correct order. Easy as well, putting an index on Position and using “order by Position”. Now the problem: Items change their Position