2,104 questions
0
votes
0
answers
116
views
Postgresql, recursive view with getting rows of older iterations
I would like to do some calculations with postgresql in a recursive / iterative way.
Here is a very rudimentary example: There is a line and on the line are 2 points. I want to create new points in ...
0
votes
1
answer
246
views
How can i get all the sub-children?
source link
Hello guys, so i have a function ("flecheD"),
(ColChild,ColParent,ParentActuel,source)=>
let
mylist=Table.Column(Table.SelectRows(...
0
votes
1
answer
824
views
How to query a tree like structure with multiple tables recursively?
Here is my ER diagram. If I know the user_id, how can I get a single user's user data=>projects=>boards=>posts using a single SQL query?
I have found out about recursive CTE, but all of the ...
0
votes
1
answer
118
views
Types don't match between the anchor and the recursive part in column "manager_name" of recursive query "manager"
I always get the error
Types don't match between the anchor and the recursive part in column "manager_name" of recursive query "manager".
on the following query, even when ...
0
votes
1
answer
207
views
Snowflake -WITH RECURSIVE... is too long and would be truncated in 'CONCAT'
Something aparently as easy as the following query is driving me crazy, anyone can help?
SELECT * FROM
(
WITH recursive colores (id_modelo, cod_color, rango) AS
...
0
votes
1
answer
82
views
Create recursive CTE for this table [duplicate]
I have a table like this:
|id |name |parent|
+-------+----------+------+
|1 |iran | |
|2 |iraq | |
|3 |tehran |1 |
|4 |tehran |3 |
|5 ...
-1
votes
1
answer
58
views
Create a pivoted/flattened hierarchies table from a path enumeration column
I have a hierarchy table with a path enumeration column (lineage column)
mytable:
path
desc
lvl
D
Chicago
1
DADB
Los Angeles
2
DADB761
Miami
3
DADB761G93
Detroit
4
DADB761G93276
San Francisco
5
...
0
votes
0
answers
97
views
Python - Recursive function returns Runtime Error: Exception maximum recursion depth exceeded for bigger limits
I have a csv file which has 4 columns such as NEW_ID, OLD_ID, CLOSE_DATE_TXT, NEW_DATE_TXT.
The NEW_ID will have its corresponding OLD_ID.
The output should be, if the OLD_ID is same as NEW_ID then ...
3
votes
3
answers
2k
views
Retreive all child categories - sql query
I have Categories stored in a single table.
Where there is no limit on number of childerns.
I want to fetch all the linked childern categories for the provided category id:
The reason for getting the ...
0
votes
1
answer
62
views
select node-ancestors recursively
Suppose I have the following tree:
The table that stores the data is presented below accordingly:
node_id
parent_id
A
null
B
A
C
A
D
B
I want to select all node ancestors for every node in the tree.
...
0
votes
1
answer
114
views
Find all associations as a list within postgres adjacency table
Given the following:
CREATE TABLE example (
example_name varchar(50),
example_parent varchar(50)
);
insert into example (example_name, example_parent)
values
('e1', NULL),
('e2', 'e1'),
('...
1
vote
1
answer
104
views
Getting List of Employees under Head and sub heads
I want to get a list of employees who come under the given Head/Employee.
It should return all sub-heads and their sub-head and employees under him/her.
Following is the list of all Employees with ...
1
vote
1
answer
545
views
SQL / BigQuery- How to group by chain of pairs in different columns?
I am trying to aggregate rows on a chain of pairs. For example, given table:
pair0 | pair1
a z
b a
c b
d b
m n
z y
Returns:
matches
[a, z, b, c, d, y]
[m, n]
...
0
votes
1
answer
106
views
How to fill missing numbers with Null?
In SQLite how to fill in null for missing numbers from a range of 1-10 when using Group By? I have a table called DataTest:
DataID
theData
1
50
2
38
2
48
4
38
5
48
8
39
9
50
9
60
10
90
If I do SELECT ...
1
vote
1
answer
165
views
Performance Improvement: Replacing recursive method call by a recursive sql query
I have started on a new job and my first task is to improve performance of code for which user action takes 40 mins currently sometimes. On analysis I found that there is a Parent - Child - ...
0
votes
0
answers
114
views
Translate recursive Sql-query for Oracle to PostgreSQL (nvl, CONNECT BY PRIOR, START WITH, ORDER SIBLINGS BY)
I have the following query which works for Oracle and returns tree nodes depending on the input :NodeId and :Lvl parameters:
SELECT Id AS TreeId, Parent AS ParentId, MY_ID AS EntityId, name as Name
...
-1
votes
1
answer
80
views
How do I convert this connect by oracle sql query to Postgres recursive with?
How do I convert this connect by oracle sql query to Postgres recursive with?
SELECT DISTINCT connect_by_root(po1.product_offer_name) AS Offer
po.product_offer_id product_offer_id
FROM ...
0
votes
0
answers
95
views
MongoDB $graphLookup omits repeat records
I have collection in which I have defined all my products and their sub-products. The sub-products are not defined as sub-documents but as a separate document in the collection.
const ...
2
votes
2
answers
776
views
How to get a recursive tree for a single table element
I have a table of this type
| id | parent_id | | title |
parent_id refers to the id of the same table
I need to get a recursive tree for an element knowing only its parent.
it will be clearer what I ...
1
vote
0
answers
107
views
PHP recursive query based on sql select
I have 2 tables in a MariaDB
Table 1 structure:
ID (primary auto-increment) itemType(ENUM) and itemName(varchar)
The ENUM has 4 possibilities - "heading","section","text",...
1
vote
1
answer
665
views
Postgres recursive CTE with Group?
I tried to find out the masterIds as Array. please find the below
create temp table location as
select 1 as id,'World' as name,null as main_id
union all
select 2,'Asia',1
union all
select 3,'Africa',1
...
1
vote
1
answer
240
views
Query a nested data structure for locations
I have this locations table:
id
type
slug
parent_location_id
1
Country
Germany
nil
2
FederalState
Hessen
1
3
City
Frankfurt
2
4
Street
Example
3
I have a tags table which has a belongs_to logic to the ...
4
votes
1
answer
2k
views
Stop recursion in postgres as soon as the condition is met
I have this table of a hierarchy
select * from product_categories;
id | parent_id | item | rule
----+-----------+--------------+---------------
1 | | ecomm |
2 | ...
0
votes
1
answer
140
views
Sql server Balance Table Update Recursive
I Have a SQL Server database with a table named Balance
The table:
Id
Date
IN
OUT
Balance
3345312
2022-08-07
100
50
250
5435245
2022-08-06
50
50
200
4353451
2022-08-05
0
100
200
5762454
2022-08-04
20
...
-1
votes
1
answer
414
views
WITH RECURSIVE: is it possible to COUNT() the working table?
I am using HSQLDB 2.6.1, and I want to COUNT() the working table of a recursive CTE.
I wrote the following test:
with recursive
nums (n, m) as
(
select 1, 1 from (values(1))
union all
...