Skip to main content
Filter by
Sorted by
Tagged with
1 vote
1 answer
112 views

I have a table test with two columns, each referencing the other ID1 ID2 2 1 3 2 4 3 5 4 Given an id, I need to traverse the chain to return all the rows traversing the chain. Below is the query I ...
sg2000's user avatar
  • 325
0 votes
0 answers
32 views

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-...
gpkbz's user avatar
  • 1
-3 votes
1 answer
63 views

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 ...
saki's user avatar
  • 319
0 votes
2 answers
114 views

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 ...
marie20's user avatar
  • 895
1 vote
1 answer
48 views

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 ...
David Kerr's user avatar
  • 1,507
-5 votes
1 answer
68 views

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&...
Kondjitsu's user avatar
1 vote
2 answers
114 views

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-...
Kondjitsu's user avatar
1 vote
1 answer
87 views

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, ...
Jonathan Whitaker's user avatar
0 votes
1 answer
89 views

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....
lala's user avatar
  • 133
2 votes
2 answers
121 views

I have a table in my Postgres 17 database where both files and folders are stored. If type = 'folder', then it represents a folder; otherwise, it's a file. By default, the size field is set for all ...
Bad_m's user avatar
  • 43
0 votes
1 answer
54 views

I had assistance in creating a Postgres Pedigree process for plant breeding in 2012 via PostgreSQL Recursive via 2 parent/child tables. The pedigree parent/child hierarchy is defined by the family/...
user1888167's user avatar
0 votes
0 answers
58 views

I created the following query in MySQL 8.0, but when I try to add using phpMyAdmin I get the following error: MySQL said: #1064 - You have an error in your SQL syntax; check the manual that ...
MyAccount's user avatar
1 vote
1 answer
99 views

My question here is somewhat related to my (old and successfully answered) question here: Recursive count query in PostgreSQL. Now, I am facing a somewhat similar problem, which I am actually not ...
Chris's user avatar
  • 79
0 votes
1 answer
197 views

I would like to use a recursive CTE to generate a series of dates. I am using this CTE to cross join onto locations to generate a mapping table as a CTE where each location has a row for each date. ...
Ryan White's user avatar
2 votes
1 answer
104 views

I'm looking to clean up event data that happens to have "duplicate" rows for a given day. I want to remove rows for a day that have more than one status based on the context of the next day'...
alpacafondue's user avatar
-1 votes
2 answers
64 views

I am looking for help to translate excel formulas into Redshift SQL . With given fixed input values for rows 1 (Month ascending) and 2 (SU - some number) I have to calculate through particular cells ...
Kondjitsu's user avatar
0 votes
2 answers
91 views

I am trying to use an SQL-query to find the predecessor municipality of a municipality or, if available, other predecessor municipalities. Here is my input table (MUNICIPALMERGE): municipality_id ...
Michael S.'s user avatar
0 votes
1 answer
42 views

Using Postgres JSONB for storing my data. JSON hierarchy root -> sections -> chars. Here possibilities of sections contains child of sections. Each level contains data objects. I need filter the ...
Velmurugan K's user avatar
0 votes
2 answers
164 views

I'm a noob in the recursive domain in that I understand the syntax but I'm unable to apply it to my current problem. I'm using Postgre SQL. I have a product_id 'ABC123' that has a parent category '...
Zprak's user avatar
  • 1
0 votes
0 answers
35 views

How can I query the categories so that the parent and its related children are displayed in a single row? Example datatbase: id parent_id name 1 0 Category 2 1 subCat 1 3 ...
Fzol's user avatar
  • 21
0 votes
1 answer
74 views

Scenario: Appointments are made with start and end times. Appointments are allowed to overlap, but for reporting purposes, we need to know when there are overlapping appointments (called overbooking) ...
DBMan's user avatar
  • 13
0 votes
2 answers
74 views

I need to insert data into new table person_department using recursion. My tables for now: person id group_id 800 10 805 21 department id name group_id parent_id 1 ABC ...
Java's user avatar
  • 113
0 votes
1 answer
75 views

I'm trying to combine two CONNECT_BY_ROOT queries. They work well individually. I've been trying to combine them such that one is a subquery inside the other, but I'm falling short. Query 1 - ...
Nick's user avatar
  • 11
0 votes
1 answer
450 views

I have a complex (but highly interesting!) use case for BigQuery recursive CTE. I understand how to solve it conceptually but after hours of trying, I just can't get my head around exactly how to do ...
Adam Cunnington's user avatar
1 vote
3 answers
81 views

In May client P003 had 600 of buy_amt (sum of sales in that period) and 1000 transfer_amt. I want to calculate the remaining limit (buy_amt - transfer_amt) but starting from top to bottom and the ...
Nikoloz Kalichava's user avatar

1
2 3 4 5
43