The tag has no wiki summary.

learn more… | top users | synonyms

0
votes
1answer
31 views

hierarchical retreival of records in postgresql

I am using postgresql-9.2 . I have a table of products which stores the information about the products and its child table is content table , which contains the products linked to it. PRODUCT MASTER ...
2
votes
1answer
60 views

PL/pgSQL function or rCTE to detect depth of relations between two tables

I need to perform a PostgreSQL Function for checking the depth of relations. There is a circular binding from table a to b, back to another element in a and, in some cases back again to b. These ...
0
votes
1answer
33 views

Oracle Hierarchical query: with two node attributes NodeId and NodeType

I have the following use case where I want to make use of hierarchical queries to get the desired result. In my use case I have two types of node say 'A' and 'B'. So the unique identifier of node is ...
1
vote
0answers
41 views

How can I reduce recursion in Couchbase?

Sometimes, you need to access a certain document (A), but you do not know the key for that document (A), as that data is stored in a different document (B). So now, if you want to fetch A, it looks ...
1
vote
1answer
151 views

Recursive calls in stored procedure and temporary tables

I am trying to create a stored procedure in PostgreSQL which has recursive calls. The procedure creates a temporary table to store results. The temporary table isn't dropped after first call due to ...
3
votes
2answers
97 views

PL/pgSQL fuction to find circular references

I have two tables ID Task 1 1 2 2 3 3 4 4 Col1 depend 2 3 2 4 3 1 4 2 ID and Col1 are related through FK constraint. I want to find out all circular references. Here ID ...
2
votes
1answer
115 views

How do I sort the results of a recursive query in an expanded tree-like fashion?

Let's assume you have a nodes tables like this: CREATE TABLE nodes ( node serial PRIMARY KEY, parent integer NULL REFERENCES nodes(node), ts timestamp NOT NULL DEFAULT now() ); It ...
2
votes
1answer
115 views

Making a recursive CTE like query, but for many records

I have a table with a hierarchy ( with a recursive parentID column), for one record, I know how to get the last parent record, with the following code : declare @Id integer ;WITH CTE AS ( SELECT ...
0
votes
0answers
98 views

Teradata With Recursive

Hi All i'm having problems writing a recursive query and i ran out of options that i can think of . The query should join serial numbers in one cell coma delimited to a specific order number . ...
1
vote
1answer
118 views

Self-join unique pairs

I have a table (players) containing a list of players, I would like to pair up these players in a unique way, so that every player's opponent is unique every round (ie. every time the SELECT query is ...
1
vote
1answer
1k views

Recursive Query in MySQL using stored proceedure and CURSOR

I'm expanding our user/group system to allow for dynamic groups which are made up of other groups members. I have three tables users, groups, and relationships. For simplicity sake, lets say users ...
0
votes
1answer
150 views

Flatten recursive hierarchy

I have the following recursive query: SELECT SYS_CONNECT_BY_PATH(object_name, '\') AS path FROM user_group_nodes START WITH parent_id = '2892107544AA2278166C1AA8D123E761' CONNECT BY parent_id = PRIOR ...
1
vote
1answer
330 views

Tree structure hierarchical query sorting

I have the following structure of table. CREATE TABLE table1 ( serial_num integer NOT NULL, parent_num integer, parent_key text, key_ary_num integer[], level integer, rank integer, ...
1
vote
1answer
70 views

How do I query a table with many trees of data, for one tree?

I have a the NAICS schema loaded and all is working well. However I'm confused as how I'd query it in Postgrseql? The table looks something like this, =========NAICS_2012========= naics | ...