Skip to content
Advertisement

Tag: recursion

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

Advertisement