recursive-cte Questions

7

Solved

I'm not a SQL expert, but if anybody can help me. I use a recursive CTE to get the values as below. Child1 --> Parent 1 Parent1 --> Parent 2 Parent2 --> NULL If data population has gone wron...
Killough asked 31/7, 2015 at 6:7

2

How would I go about using the result of a recursive CTE in a query I plan to run with Ecto? For example let's say I have a table, nodes, structured as so: -- nodes table example -- id parent_id ...

4

Solved

Is it possible to combine multiple CTEs in single query? I am looking for way to get result like this: WITH cte1 AS ( ... ), WITH RECURSIVE cte2 AS ( ... ), WITH cte3 AS ( ... ) SELECT ... FROM cte...
Outwardly asked 7/2, 2016 at 0:17

1

Solved

I am trying to evaluate the impact of store visitors on the spread of COVID-19. Here is a simple scenario: VisitorA walks into store and meets Employee1 @ Time = 0. VisitorA then meets Employee2...

5

Solved

I'm trying to repeat the first specific non-empty value in a column till the next specific non-empty value in the same column. How do I do that? The data looks like this: ID | Msg ---+----- 1 ...
Lavalava asked 14/1, 2019 at 20:47

2

Solved

I have this situation: drop table #t1; drop table #t2 select * into #t1 from (select 'va1'c1,'vb1'c2,'vc1'c3 union all select 'va2'c1,'vb2'c2,'vc2'c3 union all select 'va3'c1,'vb3'c2,'vc3'c3 ...

3

Does PostgreSQL have a pseudo-column like "LEVEL" in Oracle? If not, then how can we create a column similar to "LEVEL"?

3

Solved

I want to retrieve the parentid of an id, if that parentid has a parent again retrieve it, and so on. Kind of hierarchy table. id----parentid 1-----1 5-----1 47894--5 47897--47894 am new to sql ...
Bear asked 27/1, 2015 at 12:33

4

I have the following problem: I am trying to discover all possible paths from source node (node_s) to target node (node_t). The format of the original table with graph edges is simple: | node_x |...

1

I answered a recursive CTE yesterday that exposed an issue with the way that these are implemented in SQL Server (possibly in other RDBMS, too?). Basically, when I try to use ROW_NUMBER against the...

4

I am trying to use a recursive CTE in SQL Server to build up a predicate formula from a table containing the underlying tree structure. For example, my table looks like: Id | Operator/Val | Parent...
Buttery asked 8/4, 2010 at 16:9
1

© 2022 - 2024 — McMap. All rights reserved.