2,104 questions
0
votes
0
answers
31
views
recursive sum of totals by org and descendants in redshift
I have a table like this:
total
alert
group_id
hlevel
full_path
parent_id
root_group_id
5100FFFF-60B6-D5CD-FCCD-A8A3E03F0000
1
BizA\DivA
5100FFFF-60B6-D5CD-BFBA-A8A3E03F0000
5100FFFF-60B6-D5CD-FCCD-...
0
votes
4
answers
131
views
Recursive CTE to insert an entry for every day
Consider the following:
IF OBJECT_ID('tempdb..#TetstData') IS NOT NULL
DROP TABLE #TetstData
CREATE TABLE #TetstData
(
Id INT NOT NULL,
PurchaseDate DATE NOT NULL,
DepreciationRate ...
-3
votes
1
answer
61
views
How to write recursive query for path generation and cycle detection?
I'm working with hierarchical tree data in DolphinDB and need to solve two specific programming challenges:
Generate full paths (concatenated IDs and names) for all nodes, including infinite-level ...
0
votes
1
answer
65
views
Recursive Query to generate dates not working
I am trying to generate a series of dates by RECURSION in BigQuery. Unfortunately, the solution DOESN'T work !! Can someone please explain where I might be going wrong ??
Note: I understand that ...
0
votes
2
answers
107
views
Nested Loop in SQL in BigQuery
I need to calculate few metrics for a period of days. The requirement is - For a given day, calculate the metrics based on the past 7 days. I need to output the metrics for every day for the past 2 ...
3
votes
2
answers
149
views
Recursive query for nomenclature like table with parent contains sum of all cost from children
I have a table like this:
COMPOSANT
COMPOSE
QTE
PA
COST
LEVEL
PARENT1
CHILD1
24
0
PARENT1
CHILD2
2
0
CHILD1
CHILD11
10
1
CHILD1
CHILD12
4
3
12
1
CHILD11
CHILD111
100
1
100
2
CHILD2
CHILD21
5
10
50
1
...
1
vote
1
answer
40
views
Traversing graph using recursive CTE - using "array" to store visited vertices
I'm studying graph traversal using recursive CTEs (learnSQL course). The question asks about visiting every city from a starting city. They use a "path" string built up from appended city ...
0
votes
1
answer
97
views
ORACLE Query for all connected records
I have a joining table that performs a two-way binding using a single record.
In the example below, the record with id=8 is linked to the record with id=4, and the record with id=4 is linked to the ...
-5
votes
1
answer
64
views
Trouble with recursive query in redshift
Considering following test data:
CREATE TABLE products_su
(
country varchar(2),
intprd varchar(20),
period date,
su int
);
INSERT INTO products_su (country, intprd, "period&...
2
votes
4
answers
149
views
Recursive query to figure out record which creates circular dependency
I have a postgress table incoming_records which contains 2 column supervisor_id, emp_id
create table incoming_records(supervisor_id,emp_id)as values
(null,01) --top level resources with blank ...
1
vote
2
answers
110
views
Multiple recurrence within redshift/postgres recursive query
I'm seeking help with including deeper recurrence then last row with recursive query. Source data:
CREATE TABLE products_su(country, intprd, "period", su)AS VALUES
('GL', 'Medicine', '2019-...
1
vote
1
answer
67
views
oracle query to loop through multiple records and provide the results [closed]
oracle query to loop through multiple records and provide the results
Please help qrite an oracle query to achieve above results.
input data
ID
ABRV
NXTFILL
DAYSOUT_INT
DAYSOVER_INT
TIME
123
abc
null
...
1
vote
1
answer
81
views
Recursive CTE with cycle detection using path array
I have a recursive CTE definition (graph) in Postgres that involves cycle detection: fiddle
CREATE TABLE relationships (
subject_type,
subject_id,
subject_relation,
resource_type,
...
0
votes
1
answer
104
views
CTE query for hierarchical data excluding some records despite having full hierarchy [closed]
I have a table that stores hierarchical data, where each record may have a parent_item_code referencing another record in the same table. I'm using a Common Table Expression (CTE) to build the full ...
0
votes
1
answer
89
views
Mysql slow recursive query with many join
I have a complexe query to make statistics on few tables.
I need, for each party and each thematic the number of vote between a member and a party + the number of vote with the same value (member_vote....